pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Fabio Panizzutti <panizzutti@interlogica.net>
Cc: Shridhar Daithankar <shridhar@frodo.hserus.net>
Cc: pgsql-performance@postgresql.org
Subject: Re: R: Query plan on identical tables differs . Why ?
Date: Thu, 13 May 2004 08:16:34 -0700 (PDT)
Message-ID: <20040513080130.E3465@megazone.bigpanda.com> (raw)
In-Reply-To: <006301c438f3$6ca33460$3c02020a@ufficio>
References: <006301c438f3$6ca33460$3c02020a@ufficio>

On Thu, 13 May 2004, Fabio Panizzutti wrote:


> I don't understand why the planner chose a different query plan on
> identical tables with same indexes .

Because it's more than table structure that affects the choice made by the
planner.  In addition the statistics about the values that are there as
well as the estimated size of the table have effects.  One way to see is
to see what it thinks is best is to remove the indexes it is using and see
what plan it gives then, how long it takes and the estimated costs for
those plans.

In other suggestions, I think having a (tag_id, data_tag) index rather
than (data_tag, tag_id) may be a win for queries like this. Also, unless
you're doing many select queries by only the first field of the composite
index and you're not doing very many insert/update/deletes, you may want
to drop the other index on just that field.



view thread (3+ messages)

Message-ID: <20040513080130.E3465@megazone.bigpanda.com>
Permalink:  ../20040513080130.E3465@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20040513080130.E3465@megazone.bigpanda.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: sszabo@megazone.bigpanda.com, panizzutti@interlogica.net, shridhar@frodo.hserus.net
  Subject: Re: R: Query plan on identical tables differs . Why ?
  In-Reply-To: <20040513080130.E3465@megazone.bigpanda.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