MySQL Forums
Forum List  »  Stored Procedures

Query with variables very slow
Posted by: Gianni Moretti
Date: January 27, 2012 10:38PM

Good morning,
I tried to Google finding similar problems, I found them, but I didnt' find a solution.

Basically I have a stored procedure that use a cursor to retrive some values and use each one to made a query...but cursor are working fine...

If I insert something like:

SELECT fields FROM table WHERE field1='VALUE'

this query take less that 100 msec to return values.

Instead if I made somethink like:

DECLARE value VARCHAR(50);
SET value='VALUE';
SELECT fields FROM tables WHERE field1=value

should be the same, but this query take about 4 seconds...

Someone had a similar problem and found a solutions?

Thanks in advance

Gianni

Options: ReplyQuote


Subject
Views
Written By
Posted
Query with variables very slow
2411
January 27, 2012 10:38PM
1158
January 28, 2012 06:41PM
2159
January 28, 2012 10:16PM
1249
January 29, 2012 07:09PM
1268
January 30, 2012 02:18AM
1271
January 30, 2012 03:39AM
1118
January 31, 2012 03:20AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.