pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Mark Lubratt <mark.lubratt@indeq.com>
To: pgsql-admin@postgresql.org
Subject: Re: Explain Analyze help
Date: Thu, 11 Mar 2004 10:02:31 +0100
Message-ID: <200403111002.31577.peter_e@gmx.net> (raw)
In-Reply-To: <E9DB5A93-721B-11D8-A00B-000A9579AF50@indeq.com>
References: <E9DB5A93-721B-11D8-A00B-000A9579AF50@indeq.com>

Mark Lubratt wrote:
> Obivously, I have a lot of sequential scans going on, at about what
> cost does it start to make sense to make an index?  Or, should I just
> put in a bunch of indexes and let the optimizer decide whether or not
> to use them?

Read the chapters on Indexes and Performance Tips in the documentation.  
They contain various example scenarios where indexes are useful.  Keep 
in mind that indexes are useful only if your table is large (say, 10000 
rows or more) and the fraction you select is small (say, 1%).  The 
costs that EXPLAIN prints out are not meaningful absolute values; they 
are only useful to compare two plans of the same query.  So in absence 
of a better approach, your job is to

1. EXPLAIN ANALYZE without index
2. create index
3. EXPLAIN ANALYZE with index

(And don't forget to run ANALYZE sometime.)

If there is a significant improvement, then keep the index.  Remember, 
too many indexes slow down updates.




view thread (2+ messages)

Message-ID: <200403111002.31577.peter_e@gmx.net>
Permalink:  ../200403111002.31577.peter_e@gmx.net/
Also on:    postgresql.org/message-id/200403111002.31577.peter_e@gmx.net

 · 

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-admin@postgresql.org
  Cc: peter_e@gmx.net, mark.lubratt@indeq.com
  Subject: Re: Explain Analyze help
  In-Reply-To: <200403111002.31577.peter_e@gmx.net>
  References: <E9DB5A93-721B-11D8-A00B-000A9579AF50@indeq.com> <200403111002.31577.peter_e@gmx.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