3 ms·
The workaround is to understand how the questions you're asking the database relate to the structure of your data. What you describe is a brute force way to ac
by dllthomas 4y ago
The workaround is to understand how the questions you're asking the database relate to the structure of your data. What you describe is a brute force way to acquire that understanding on the fly on arbitrary queries. It might sometimes be the best you can do, and then it might be worth it (benchmark!), but in quite a few cases it'll be quite a bit slower.
- manimino 4y agoThat's a great point. The LIMIT workaround takes no knowledge of the data distribution, but an optimizer could do much better with some statistics such as estimated percentiles.