pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerald Gutierrez <gutz@kalador.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-sql@postgresql.org
Subject: Re: VACUUM kills Index Scans ?!
Date: Thu, 15 Mar 2001 13:06:22 -0800
Message-ID: <5.0.2.1.0.20010315125737.0282b9c0@kalador.com> (raw)
In-Reply-To: <15040.984687683@sss.pgh.pa.us>
References: <5.0.2.1.0.20010315113535.0282b750@kalador.com>
	<5.0.2.1.0.20010315113535.0282b750@kalador.com>


>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

I also understand that VACUUM and VACUUM ANALYZE takes a significant amount 
of time and locks the tables that it works on. Does it do locking and 
unlocking per table as it goes through them (i.e. only lock while it's 
reading the table) or does it do something else? If the locks are for large 
amounts of time I'll have to shut down my application to avoid connections 
from timing out and JDBC exceptions from being thrown.

Thanks for your help :)






view thread (6+ messages)  latest in thread

Message-ID: <5.0.2.1.0.20010315125737.0282b9c0@kalador.com>
Permalink:  ../5.0.2.1.0.20010315125737.0282b9c0@kalador.com/
Also on:    postgresql.org/message-id/5.0.2.1.0.20010315125737.0282b9c0@kalador.com

 · 

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: gutz@kalador.com, tgl@sss.pgh.pa.us
  Subject: Re: VACUUM kills Index Scans ?!
  In-Reply-To: <5.0.2.1.0.20010315125737.0282b9c0@kalador.com>
  References: <5.0.2.1.0.20010315113535.0282b750@kalador.com> <5.0.2.1.0.20010315125737.0282b9c0@kalador.com>

* 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