in reply to Re^2: DB Question, speed is the answer!
in thread DB Question, speed is the answer!
is going to perform a full table scan, no matter how many rows your return set has. By wildcarding on the left and right, you're defeating any index that the table would have, so it has no choice but to scan the whole table.MASTERTABLE.NUMBER LIKE '%1324940%'
If it's running faster the second time you run it, it's because the data is likely still cached from your first run.
You might try re-working this into either two queries, or at least a sub-query, where you do:
first, which will reduce your initial set, and *then* do the LIKE against that return set.( MASTERTABLE.SERIAL = 'FF' OR MASTERTABLE.SERIAL = 'CC' OR MASTERTABLE.SERIAL = 'OO' OR MASTERTABLE.SERIAL = 'NN')
That should help some
TrekNoid
|
---|