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
>
>

Reply via email to