pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Allen Landsidel <all@biosys.net>
To: pgsql-performance@postgresql.org
Subject: Re: index creation order?
Date: Fri, 31 Oct 2003 10:58:19 -0800
Message-ID: <200310311058.19455.josh@agliodbs.com> (raw)
In-Reply-To: <6.0.0.22.0.20031031131506.024864b0@pop.hotpop.com>
References: <6.0.0.22.0.20031031104214.024853b0@pop.hotpop.com>
	<200310310910.30504.josh@agliodbs.com>
	<6.0.0.22.0.20031031131506.024864b0@pop.hotpop.com>

Allen,

> I had no idea analyze was playing such a big role in this sense.. I really
> thought that other than saving space, it wasn't doing much for tables that
> don't have indexes on the.

Among other things, ANALYZE tells postgres how many rows are in the table.  So 
if you add a PK constraint after loading 10 million rows without ANALYZE, 
PostgreSQL is likely to think that there is only one row in the table ... and 
choose a nested loop or some other really inefficient method of checking for 
uniqueness.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco



view thread (11+ messages)  latest in thread

Message-ID: <200310311058.19455.josh@agliodbs.com>
Permalink:  ../200310311058.19455.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200310311058.19455.josh@agliodbs.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: josh@agliodbs.com, all@biosys.net
  Subject: Re: index creation order?
  In-Reply-To: <200310311058.19455.josh@agliodbs.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