Re: The usual sequential scan, but with LIMIT ! - Mailing list pgsql-performance

From Dennis Bjorklund
Subject Re: The usual sequential scan, but with LIMIT !
Date
Msg-id Pine.LNX.4.44.0409061440040.9559-100000@zigo.dhs.org
Whole thread Raw
In response to The usual sequential scan, but with LIMIT !  (Pierre-Frédéric Caillaud<lists@boutiquenumerique.com>)
List pgsql-performance
On Mon, 6 Sep 2004, [iso-8859-15] Pierre-Frédéric Caillaud wrote:

>     Why is it that way ? The planner should use the LIMIT values when
> planning the query, should it not ?

And it do use limit values, the estimated cost was lower when you had the
limit,

What you need to do is to tune pg for your computer. For example the
following settings:

 * effective_cache - this setting tells pg how much the os are caching
  (for example use top to find out during a normal work load). You said
  that the tables fit in memory and by telling pg how much is cached it
  might adjust it's plans accordingly.

* random_page_cost - how expensive is a random access compared to seq.
  access. This is dependent on the computer and disk system you have.
  If the setting above does not help, maybe you need to lower this to
  variable to 2 or something.

And don't forget the shared_buffer setting. But most people usually have
it tuned in my experience (but usually too high). Here is an article that
might help you:

  http://www.varlena.com/varlena/GeneralBits/Tidbits/perf.html

--
/Dennis Björklund


pgsql-performance by date:

Previous
From: Pierre-Frédéric Caillaud
Date:
Subject: Re: The usual sequential scan, but with LIMIT !
Next
From: Markus Schaber
Date:
Subject: Re: Multiple Uniques