List:General Discussion« Previous MessageNext Message »
From:Johan De Meersman Date:December 13 2012 9:26am
Subject:Re: using LIMIT without ORDER BY
View as plain text  
----- Original Message -----

> From: "Akshay Suryavanshi" <akshay.suryavanshi50@stripped>

> I was referring to a condition when there is no index on the tables,
> not even primary keys.
If you have a lot of data in there, may I suggest you (temporarily) add a unique index and
benchmark both methods? As I said, limit n,m is the last operation that gets executed, so
it requires rows 0-n to be fetched, too. On deep pages that can be quite a lot of data
needlessly fetched. 

You might find that the expense of maintaining that index may be well worth the speedup
when fetching pages. 

> Your explanation makes complete sense about the optimizer and the
> pagination queries.

> Thanks,
You're welcome. 

-- 

Unhappiness is discouraged and will be corrected with kitten pictures. 

Thread
using LIMIT without ORDER BYjiangwen jiang13 Dec
  • Re: using LIMIT without ORDER BYAkshay Suryavanshi13 Dec
    • Re: using LIMIT without ORDER BYJohan De Meersman13 Dec
      • Re: using LIMIT without ORDER BYAkshay Suryavanshi13 Dec
        • Re: using LIMIT without ORDER BYJohan De Meersman13 Dec