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: 20080831195421.GB3856@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Fetter 2008-08-31 20:43:15 Re: Oracle and Postgresql
Previous Message M2Y 2008-08-31 18:29:32 Oracle and Postgresql