Re: Is there a way too speed up Limit with high OFFSET ?

From: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
To: Georgi Ivanov <georgi(dot)r(dot)ivanov(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there a way too speed up Limit with high OFFSET ?
Date: 2010-08-12 07:47:38
Message-ID: 4C63A71A.2090104@lelarge.info
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le 12/08/2010 09:43, Georgi Ivanov a écrit :
> [...]
> I have query like this
> Select * from tabelname limit 10 OFFSET 10;
>
> If i increase the OFFSET to 1000 for example, the query runs slower . The
> bigger is OFFSET the slower is the query.
>
> This is standard pagination feature i use for my website.
> Actually the query is little bit more complex than this, but it is generally
> a
> select with a join.
>
> So i wander if there is a way to speed up this kind of query ?
>

You should better use cursors, than the OFFSET/LIMIT clause.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2010-08-12 07:49:31 Re: Is there a way too speed up Limit with high OFFSET ?
Previous Message Georgi Ivanov 2010-08-12 07:43:06 Is there a way too speed up Limit with high OFFSET ?