|
Hi, can I use stored procedure to sync data from other database using DBLink? What are the possible querries that I need to do in this process?
|
|
|
|
|
KingJames06 wrote: Hi, can I use stored procedure to sync data from other database using DBLink?
Dunno, I don't know DBLink. Hence, I can also not say if it is an easier or more efficient approach than the Sync Framework which I did recommend.
KingJames06 wrote: What are the possible querries that I need to do in this process?
Depends on your database and it's structure. Syncing is a delicate process, I suggest you take a few days to read everything on the topic that you can find
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
hi,
I am doing this stored procedure but getting Subquery returns more than 1 row
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_populate_advertisement`(IN `param_volow_banner_size` varchar(255))
BEGIN
SET @random_banner = (SELECT volow_banner_id FROM volow_banners WHERE volow_banner_size = param_volow_banner_size ORDER BY RAND());
INSERT INTO volow_banner_log (volow_banner_id) VALUES (@random_banner);
SELECT volow_banner_file FROM volow_banners WHERE volow_banner_id = @random_banner;
END
can you help please..
|
|
|
|
|
SET @random_banner = (SELECT volow_banner_id FROM volow_banners WHERE volow_banner_size = param_volow_banner_size ORDER BY RAND());
should be
SET @random_banner = (SELECT volow_banner_id FROM volow_banners WHERE volow_banner_size = param_volow_banner_size ORDER BY RAND() LIMIT 1);
I wasn't, now I am, then I won't be anymore.
modified 24-Oct-12 16:49pm.
|
|
|
|
|
|
what db are you using. I wasn't paying attention and assumed MSSQL.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
|
I've updated my original answer to reflect MySql. Sorry for the confusion.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
working now.
thanks Marcus
|
|
|
|
|
You are welcome.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Hi,
I have a SP that calculates data based on criteria, the result were % and duration. It takes 8-10 seconds before it displays the result.
The problem is when more users are trying to generate the report, it seems that it takes more time.
My problem was when I tried to update a simple statement such as below, it resulted to a "time out expired" and it affects the entire process of the application becuase users cannot perform their task.
update table
set status = 1
where keyId = 6
I don't have any locking on my select nor update.
What is the best practice to resolve it?
I have 100 users nationwide aside from report users, please need help.
Thanks in advance
Dabuskol
Dabsukol
|
|
|
|
|
dabuskol wrote: I have a SP that calculates data based on criteria, the result were % and duration. It takes 8-10 seconds before it displays the result.
You *could* use the SP to retrieve the bare results, and do the calculations in code (on the client) - that would take some work of the server. Post the SP here, and we could have a look at optimizing it.
dabuskol wrote: The problem is when more users are trying to generate the report, it seems that it takes more time.
That's not a problem, but expected behavior; more requests for the database means simply more work.
dabuskol wrote: I don't have any locking on my select nor update.
What is the best practice to resolve it?
Locking wouldn't help much; you'd still get a time-out if the query does not return within the set timeout-period. Depending on your needs, you could have it timeout after half an hour.
Still, best idea would be to move the calculations, limit the joins and optimize the query.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Eddy is correct, locking is not the issue here, also check to see if you have spit triggers on the table.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
He's talking about a SELECT statement, not an UPDATE . No amount of locking is going to speed up reading.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Any idea what that will do to a database that's not "well designed"? Really think it improves speed? Ever heard of the term "dirty read"??
Stop and THINK for a second - if it were a matter of adding that keyword, wouldn't it be more simple to have the dirty read by default, whether or not the keyword is included?
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Aadhar Joshi wrote: please go through it when it actually creates problem..
Ah, sorry, something else ruined my mood - I'm gone.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
U please read the question..
he is talking about only 100 clients..
u know in a second how many number of locks sql can handle??
every time i don't belive i am good enough for all condition.. same applies to u also..
|
|
|
|
|
Aadhar Joshi wrote: he is talking about only 100 clients..
u know in a second how many number of locks sql can handle??
Yes, I do.
Aadhar Joshi wrote: every time i don't belive i am good enough for all condition.. same applies to u also..
Making mistakes is the only way I learn; trial and error, and the forum is filled with mistakes I made. Drop the subject and the assumptions, it should not have become this personal.
It's just code. Something we do.
Now excuse me, the hedonist in me is calling.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
The reason I dislike the dirty read is because it's not fun if you have to debug a race-condition. Imagine the app being a huge success, and being used in another department with ten times the amount of users. Imagine a simple employee-count being incorrect, because only the employee-record has been inserted, but not yet the contract on which the query joins.
Having a consistent and reliable database is "always" more important than having a speedy one.
Yes, I'm always this rude, just not that touchy. Got some red wine, some red meat, it's time to relax a bit and have a party. It's good to see a dev with passion, and even better to see one defend his opinion. I hope you're gonna stick around, you'll see I'm not an arse all the time. (Sometimes I'm offline and asleep).
FWIW, you'll already have seen this[^] page? That's where you must have found the "cheat" to read before all writes are done. You'll have to assume that most programmers don't use the documentation. If it does not produce any problems with your current architecture, then great - means someone put some extra effort in designing the database. If not, mark it and highlight it and explain what it does with comments in code, as most programmers will not go to MSDN. They'll not even ask here.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
I apologies for what i did..
I know i should listen you first but as u said i am a small kid and i need to go far away..
I can not compete with u, your knowledge, your points but as a senior u should have helping hands..
I can learn today a big lesson and now i can think i was fool for what i did and totally unprofessional..
I have to go far away, I hope i get support from u and u help a kid to grow up..
Sorry,
Aadhar
|
|
|
|
|