Re: Speed Up Offset and Limit Clause - Mailing list pgsql-performance

From Jim C. Nasby
Subject Re: Speed Up Offset and Limit Clause
Date
Msg-id 20060517190400.GV26212@pervasive.com
Whole thread Raw
In response to Re: Speed Up Offset and Limit Clause  ("Craig A. James" <cjames@modgraph-usa.com>)
List pgsql-performance
On Tue, May 16, 2006 at 07:20:12PM -0700, Craig A. James wrote:
> >Why I want to use offset and limit is for me to create a threaded
> >application so that they will not get the same results.
>
> In order to return rows 10000 to 15000, it must select all rows from zero
> to 15000 and then discard the first 10000 -- probably not what you were
> hoping for.
>
> You might add a "thread" column.  Say you want to run ten threads:

Another possibility is partitioning the table. If you do that using
inheritance-based partitioning, you could just select directly from
different partition tables, which probably be even faster than using a
single table. The downside is it's more work to setup.
--
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-performance by date:

Previous
From: "Craig A. James"
Date:
Subject: Re: Optimizer: limit not taken into account
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Optimizer: limit not taken into account