On Mon, Mar 4, 2013 at 2:14 AM, Alan J Davies <
alan.dav...@aldis-systems.co.uk> wrote:

>
>
> What do you want to do with the returned data? View it? Can you handle
> more than 20 records at a time on your screen?
>


> select first 20 field_value,field_value1,field_value2,field_value100
> from table
> where field_value = 1 (and field_value2=2)
> order by field_value,field_value2
>

That version of the query is likely to have performance problems unless
there's a compound ascending index on the combination of field_value and
field_value2.  Without that index, the query will first find all the
records that match the where conditions, sort them return the first 20 and
throw out the rest.  If you had to scan to find the next 20, it would do
the same, but throw out the first 20, return the next 20 and throw out the
rest.  And to get the next twenty, it again retrieves and sorts all
qualifying records, and throw out all but 20.

Good luck,

Ann


[Non-text portions of this message have been removed]

Reply via email to