From: Ross J. Reedstrom <reedstrm@rice.edu>
To: Postgres <pgsql-admin@postgresql.org>
Subject: Re: what is the cause that scan type is showing as 'seq scan' after indexing
Date: Sun, 26 Jan 2003 10:44:18 -0600
Message-ID: <20030126164418.GB20331@wallace.ece.rice.edu> (raw)
In-Reply-To: <002701c2c53b$176df660$1201a8c0@a4005>
References: <002701c2c53b$176df660$1201a8c0@a4005>
On Sun, Jan 26, 2003 at 06:31:50PM +0530, shreedhar wrote:
> Hi All,
>
> Before indexing query plan was showing cost as 40.00, after indexing query
> plan again showing as 'seq scan' and cost as 3060.55.
> The field which i indexed is primary key to this table.
> May i know
> 1) what is the cause that scan type is showing as 'seq scan' after indexing
> also
> 2) why it is showing cost as high value compare to previous.
You trimmed out the other parts of the EXPLAIN, so I'm just guessing,
but that cost seems suspiciously round: I'm guessing that you haven't
run VACUUM ANALYZE at all. One thing indexing does is update the 'number
of tuples' statistic. See the archives for why sequential scans still
show up (short answer: index scans aren't free, so at some point, it's
cheaper to scan the entire table than to scan both the index and the
subset of the table returned)
Ross
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-admin@postgresql.org
Cc: reedstrm@rice.edu
Subject: Re: what is the cause that scan type is showing as 'seq scan' after indexing
In-Reply-To: <20030126164418.GB20331@wallace.ece.rice.edu>
References: <002701c2c53b$176df660$1201a8c0@a4005> <20030126164418.GB20331@wallace.ece.rice.edu>
* 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