Skip site navigation (1) Skip section navigation (2)

Re: query with offset stops using index scan

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Stanislav Raskin <sr(at)brainswell(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: query with offset stops using index scan
Date: 2008-08-31 19:54:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
Stanislav Raskin wrote:

> Now, if I increase OFFSET slowly, it works all the same way, until OFFSET
> reaches the value of 750. Then, the planner refuses to use an index scan and
> does a plain seq scan+sort, which makes the query about 10-20 times slower:

You may want to try setting enable_seqscan to off before that query (and
making sure you turn it back on; preferably use SET LOCAL inside a
transaction block) so that it gives more preference to the indexscan.

Alvaro Herrera                      
The PostgreSQL Company - Command Prompt, Inc.

In response to

pgsql-general by date

Next:From: David FetterDate: 2008-08-31 20:43:15
Subject: Re: Oracle and Postgresql
Previous:From: M2YDate: 2008-08-31 18:29:32
Subject: Oracle and Postgresql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group