I apologize that we are using this mail-list dedicated to mod_perl.
Normally the page to be returned to the frontend for display has a few
rows (tens) and therefore perform Join with a table of keys or use IN
(...) m but also key = X OR key = Y OR ... makes little difference.
In my case the recordset can be the result of JOIN (even more than one)
with WHERE and ORDER ... all handled by the framework.
I have not found more efficient method.
gdo
Il 10/08/24 08:11, Mithun Bhattacharya ha scritto:
True - it will not return enough results if it is a sparse matrix. I
might be biased because in my work it is ok to give less results if it
is significantly faster.
If exact numbers are required and the count is significantly higher
then I would suggest keeping the select on primary keys but switch
from a IN clause to a temporary table and do a join.
On Sat, Aug 10, 2024, 12:54 AM Guido Brugnara <g...@leader.it> wrote:
Il 09/08/24 20:28, Mithun Bhattacharya ha scritto:
First one is expensive and s cond is inefficient. Instead get the
max and min and split the numbers into appropriate batch. So if
it is 345 to 25636 then 345 - 1345, 1346-2345 and so on and so
forth. Why is the second querry inefficient because the IN clause
is much slower than doing a between on the primary key
Your method works only if the recordset contains adjacent primary
keys.
This condition happens only if you paginate a table without
filters and sorting.
bye
gdo