pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Brice Ruth <brice@webprojkt.com>
Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Query never returns ...
Date: Thu, 08 Feb 2001 13:50:57 -0500
Message-ID: <12434.981658257@sss.pgh.pa.us> (raw)
In-Reply-To: <3A82CEB1.764160D5@webprojkt.com>
References: <Pine.BSF.4.21.0102080844480.54197-100000@megazone23.bigpanda.com>
	<3A82CEB1.764160D5@webprojkt.com>

Brice Ruth <brice@webprojkt.com> writes:
> As for vacuum analyze - prior to running into these problems, I deleted
> all data from the database (using delete from <tblname>) and then ran
> vacuumdb -a, after which I loaded the data into the tables using 'copy
> ... from' - there have been no updates to the database since then -
> merely selects.

That was the wrong order to do things in :-(.  The VACUUM ANALYZE posted
statistics showing all your tables as empty, and the planner is now
faithfully choosing plans that are good for tiny tables --- ie, minimal
startup cost and don't worry about per-tuple cost.

There has been some talk of having stats automatically updated by COPY,
but right now it doesn't happen.  So the correct procedure is to do a
VACUUM ANALYZE on a table *after* you do any sizable data additions.

BTW, people have occasionally stated on the list that you need to redo
VACUUM ANALYZE after adding/dropping indexes, but that's not true, at
least not in the present state of the world.  VACUUM ANALYZE only posts
stats about the data in the table(s).  The planner always looks at the
current set of indices for a table, together with the last-posted data
statistics, to choose a plan.

			regards, tom lane



view thread (12+ messages)

Message-ID: <12434.981658257@sss.pgh.pa.us>
Permalink:  ../12434.981658257@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12434.981658257@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, brice@webprojkt.com, sszabo@megazone23.bigpanda.com, pgsql-general@postgresql.org
  Subject: Re: [SQL] Query never returns ...
  In-Reply-To: <12434.981658257@sss.pgh.pa.us>
  References: <Pine.BSF.4.21.0102080844480.54197-100000@megazone23.bigpanda.com> <3A82CEB1.764160D5@webprojkt.com> <12434.981658257@sss.pgh.pa.us>

* 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