From: Joseph Shraibman <jks@selectacast.net>
To: Gerald Gutierrez <gutz@kalador.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: VACUUM kills Index Scans ?!
Date: Mon, 19 Mar 2001 21:05:26 -0500
Message-ID: <3AB6BAE6.5DE53B8D@selectacast.net> (raw)
References: <5.0.2.1.0.20010315113535.0282b750@kalador.com>
<5.0.2.1.0.20010315113535.0282b750@kalador.com>
<5.0.2.1.0.20010315125737.0282b9c0@kalador.com>
Gerald Gutierrez wrote:
>
> >There is an undocumented little factoid here: CREATE INDEX will update
> >(some of) the planner stats, but only if it finds some data in the
> >table. CREATE INDEX on an empty table leaves the initial default
> >numbers alone. This may be contributing to your confusion, but it was
> >deemed necessary ...
>
> I understand now; it makes sense. I'll be using a number of tables that are
> initially very small, perhaps 5 or 10 records. But I expect that the tables
> will grow very quickly to several tens (or hundreds) of thousands of
> records. It seems reasonable to me that the table should then be set up to
> use index scan right from the beginning so that as the table grows the
> index scan will become more useful. Thus, the correct sequence for me is
> probably:
>
> > CREATE TABLE
> > CREATE INDEX
> > load data
>
no, the correct sequence is to create the index last, which will create
statistics that will tell postgres if it really wants to use an index or
not. Don't try and second guess postgres.
Even better do a VACUUM ANALYZE.
--
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio. http://www.targabot.com
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-sql@postgresql.org
Cc: jks@selectacast.net, gutz@kalador.com
Subject: Re: VACUUM kills Index Scans ?!
In-Reply-To: <3AB6BAE6.5DE53B8D@selectacast.net>
References: <5.0.2.1.0.20010315113535.0282b750@kalador.com> <5.0.2.1.0.20010315125737.0282b9c0@kalador.com> <3AB6BAE6.5DE53B8D@selectacast.net>
* 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