pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Jens Hoffrichter <jens.hoffrichter@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: Getting rid of a seq scan in query on a large table
Date: Mon, 27 Jun 2011 09:30:23 -0500
Message-ID: <4E084DAF020000250003EC54@gw.wicourts.gov> (raw)
In-Reply-To: <BANLkTik0KVOg8itw_ud-s8_TtK9kzt-O=Q@mail.gmail.com>
References: <BANLkTik0KVOg8itw_ud-s8_TtK9kzt-O=Q@mail.gmail.com>

Jens Hoffrichter <jens.hoffrichter@gmail.com> wrote:
 
> I'm having trouble getting rid of a sequential scan on a table
> with roughly 120k entries it.
 
Please post your configuration information and some information
about your hardware and OS.
 
http://wiki.postgresql.org/wiki/SlowQueryQuestions
 
Since the table scan went through about 120000 rows in 60 ms, it is
clear that your data is heavily cached, so random_page_cost should
probably be close to or equal to seq_page_cost, and that value
should probably be somewhere around 0.1 to 0.5.  You should have
effective_cache_size set to the sum of shared_buffers plus whatever
your OS cache is.  I have sometimes found that I get faster plans
with cpu_tuple_cost increased.
 
If such tuning does cause it to choose the plan you expect, be sure
to time it against what you have been getting.  If the new plan is
slower, you've taken the adjustments too far.
 
-Kevin



view thread (3+ messages)  latest in thread

Message-ID: <4E084DAF020000250003EC54@gw.wicourts.gov>
Permalink:  ../4E084DAF020000250003EC54@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4E084DAF020000250003EC54@gw.wicourts.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, jens.hoffrichter@gmail.com
  Subject: Re: Getting rid of a seq scan in query on a large table
  In-Reply-To: <4E084DAF020000250003EC54@gw.wicourts.gov>
  References: <BANLkTik0KVOg8itw_ud-s8_TtK9kzt-O=Q@mail.gmail.com> <4E084DAF020000250003EC54@gw.wicourts.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox