does MySQL short-circuit?

GeX

GeX

Soldato
Joined
17 Dec 2002
Posts
6,982
Location
Manchester
Got some fairly hefty tables in a DB at work and from time to time (rarely) I need to look through them when something goes a bit wonky.

I have been using;

Code:
SELECT * FROM table WHERE cData LIKE '%search_term%' ORDER BY dtCreated DESC;

This is taking an age, so I altered it slightly;

Code:
SELECT * FROM table WHERE dtCreated > '2010-12-01 00:00:00' AND cData LIKE '%search_term%' ORDER BY dtCreated DESC;

My thinking would be that it'd short-circuit and speed up a lot. It did not.

Is there a way to get MySQL to short-circuit? Is there a better way of doing what I'm trying to do? I cannot alter the DB structure at this time.
 
hmmm, nothing really in it. 1288 seconds vs 1213 seconds. Both far too slow. Going to try dropping the dtCreated
 
thanks guys. I'm going to look into adding an index to dtCreated - not sure when that'll be able to happen though!
 
Back
Top Bottom