Best use of likeprows
Posted: Sun Sep 19, 2004 1:02 am
A common scenario might be that you have 3 things that you want to accomplish to a query:
1) Tell the user how many results there are (even if there are far many total results than are initially being displayed).
2) Display the first X number of results.
3) Allow for the user to see more results from the search in batches of "Y" at a time.
The default for likeprows is 100. That is far too low for my purposes. What is the best way to use likeprows to allow #1 - #3 above? Is it to just set likeprows for the maximum value that #3 will allow the user to get to? Or do something more complicated like always setting likeprows to be equal to the highest number that the user can view on a given page?
Also, can you clarify if likeprows = 100 is returning the FIRST 100 results, or the BEST 100 results? I'm pretty sure it is the best 100 out of all possible matches, but if that is the case, I don't understand why there is a huge (orders of magnitude) difference between this query when run with likeprows=0 (infinite) versus likeprows=5000:
SELECT COUNT(*) from table WHERE field LIKEP '%metalic';
With likeprows=0 set, this query didn't finish in 10 minutes, while it took about 14 seconds with likeprows=5000. This doesn't make sense to me: It must be able to find all the matches relatively quickly, since, assuming my understanding of likeprows is correct, whether likeprows is infinite, 100, or 5000, it has to find all the matching records. And, it has to rank them all in each scenario too, doesn't it? Otherwise it couldn't know what the best "X" hits are. I know it will require a linear scan, so it may be slow, but why the large difference when it seems like most of the hard work is done just to get to the point of determining which the best "X" results are?
By the way, I have tried to use LIKER with this to see if I can avoid post-processing for testing purposes, and the query keeps coming back with 0 hits using LIKER. I don't know why.
1) Tell the user how many results there are (even if there are far many total results than are initially being displayed).
2) Display the first X number of results.
3) Allow for the user to see more results from the search in batches of "Y" at a time.
The default for likeprows is 100. That is far too low for my purposes. What is the best way to use likeprows to allow #1 - #3 above? Is it to just set likeprows for the maximum value that #3 will allow the user to get to? Or do something more complicated like always setting likeprows to be equal to the highest number that the user can view on a given page?
Also, can you clarify if likeprows = 100 is returning the FIRST 100 results, or the BEST 100 results? I'm pretty sure it is the best 100 out of all possible matches, but if that is the case, I don't understand why there is a huge (orders of magnitude) difference between this query when run with likeprows=0 (infinite) versus likeprows=5000:
SELECT COUNT(*) from table WHERE field LIKEP '%metalic';
With likeprows=0 set, this query didn't finish in 10 minutes, while it took about 14 seconds with likeprows=5000. This doesn't make sense to me: It must be able to find all the matches relatively quickly, since, assuming my understanding of likeprows is correct, whether likeprows is infinite, 100, or 5000, it has to find all the matching records. And, it has to rank them all in each scenario too, doesn't it? Otherwise it couldn't know what the best "X" hits are. I know it will require a linear scan, so it may be slow, but why the large difference when it seems like most of the hard work is done just to get to the point of determining which the best "X" results are?
By the way, I have tried to use LIKER with this to see if I can avoid post-processing for testing purposes, and the query keeps coming back with 0 hits using LIKER. I don't know why.