From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Sok Ann Yap <sokann@gmail.com>
To: pgsql-performance@postgresql.org
Subject: Re: reducing random_page_cost from 4 to 2 to force index scan
Date: Tue, 26 Apr 2011 16:37:15 -0500
Message-ID: <4DB6F4BB020000250003CEB9@gw.wicourts.gov> (raw)
In-Reply-To: <BANLkTikZhYc+h1=YDJfXwZEZc1tN3_VwCg@mail.gmail.com>
References: <BANLkTikZhYc+h1=YDJfXwZEZc1tN3_VwCg@mail.gmail.com>
Sok Ann Yap <sokann@gmail.com> wrote:
> So, index scan wins by a very small margin over sequential scan
> after the tuning. I am a bit puzzled because index scan is more
> than 3000 times faster in this case, but the estimated costs are
> about the same. Did I do something wrong?
Tuning is generally needed to get best performance from PostgreSQL.
Needing to reduce random_page_cost is not unusual in situations
where a good portion of the active data is in cache (between
shared_buffers and the OS cache). Please show us your overall
configuration and give a description of the hardware (how many of
what kind of cores, how much RAM, what sort of storage system). The
configuration part can be obtained by running the query on this page
and pasting the result into your next post:
http://wiki.postgresql.org/wiki/Server_Configuration
There are probably some other configuration adjustments you could do
to ensure that good plans are chosen.
-Kevin
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, sokann@gmail.com
Subject: Re: reducing random_page_cost from 4 to 2 to force index scan
In-Reply-To: <4DB6F4BB020000250003CEB9@gw.wicourts.gov>
References: <BANLkTikZhYc+h1=YDJfXwZEZc1tN3_VwCg@mail.gmail.com> <4DB6F4BB020000250003CEB9@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