pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: brad-pgperf@duttonbros.com
Cc: pgsql-performance@postgresql.org
Subject: Re: planner/optimizer question
Date: Wed, 28 Apr 2004 00:27:59 -0400
Message-ID: <23032.1083126479@sss.pgh.pa.us> (raw)
In-Reply-To: <20040426171103.45600.qmail@uno.mnl.com>
References: <20040426171103.45600.qmail@uno.mnl.com>

brad-pgperf@duttonbros.com writes:
> ... Wouldn't the most efficient plan be to scan the index regardless
> of crm_id because the only columns needed are in the index?

No.  People coming from other databases often have the misconception
that queries can be answered by looking only at an index.  That is never
true in Postgres because row validity info is only stored in the table;
so we must always visit the table entry to make sure the row is still
valid/visible for the current query.

Accordingly, columns added to the index that aren't constrained by the
WHERE clause are not very useful ...

			regards, tom lane



view thread (37+ messages)  latest in thread

Message-ID: <23032.1083126479@sss.pgh.pa.us>
Permalink:  ../23032.1083126479@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/23032.1083126479@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, brad-pgperf@duttonbros.com
  Subject: Re: planner/optimizer question
  In-Reply-To: <23032.1083126479@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