Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-29 Thread hubert depesz lubaczewski
On Wed, Aug 28, 2013 at 01:39:46PM -0700, fburg...@radiantblue.com wrote: >Can anyone offer suggestions on how I can optimize a query that contains > the LIMIT OFFSET clause? >The explain plan of the query is included in the notepad attachment. >thanks large offsets are slow, and ther

Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-28 Thread David Rowley
On Thu, Aug 29, 2013 at 8:39 AM, wrote: > Can anyone offer suggestions on how I can optimize a query that contains > the LIMIT OFFSET clause? > > The explain plan of the query is included in the notepad attachment. > > thanks > > Before I write anything, I should warn that it has been a while sin

Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-28 Thread Merlin Moncure
On Wed, Aug 28, 2013 at 3:39 PM, wrote: > Can anyone offer suggestions on how I can optimize a query that contains the > LIMIT OFFSET clause? > > The explain plan of the query is included in the notepad attachment. OFFSET is working as designed (that is, slowly). Managing pagination with OFFSET

Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-28 Thread fburgess
ink.thanksĀ  Original Message Subject: Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6 From: Greg Spiegelberg <gspiegelb...@gmail.com> Date: Wed, August 28, 2013 2:26 pm To: fburg...@radiantblue.com Cc: pgsql-performance <pgsql-performance@postgresql.org> Two solution

Re: [PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-28 Thread Greg Spiegelberg
Two solutions come to mind. First possibility is table partitioning on the column you're sorting. Second, depending on your application, is to use a cursor. Cursor won't help with web applications however a stateful application could benefit. HTH -Greg On Wed, Aug 28, 2013 at 2:39 PM, wrote:

[PERFORM] Poor OFFSET performance in PostgreSQL 9.1.6

2013-08-28 Thread fburgess
Can anyone offer suggestions on how I can optimize a query that contains the LIMIT OFFSET clause?The explain plan of the query is included in the notepad attachment.thanksThe rows skipped by an OFFSET clause still have to be computed inside the server; therefore a large OFFSET might be inefficient