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

From: Georgi Ivanov <georgi(dot)r(dot)ivanov(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Is there a way too speed up Limit with high OFFSET ?
Date: 2010-08-12 07:43:06
Message-ID: AANLkTik-pZRpGTNcDrk-jauw7PTK23-szXxTTK+KqdLF@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
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 ?

I'm now reading about windowing functions , but I'm not sure this is the way

to go for this feature.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guillaume Lelarge 2010-08-12 07:47:38 Re: Is there a way too speed up Limit with high OFFSET ?
Previous Message Scott Marlowe 2010-08-12 07:07:35 Re: MySQL versus Postgres