pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Rick Schumeyer <rschumeyer@ieee.org>
Cc: pgsql-performance@postgresql.org
Subject: Re: index scan on =, but not < ?
Date: Tue, 8 Mar 2005 22:38:21 -0600
Message-ID: <20050309043821.GA1569@wolff.to> (raw)
In-Reply-To: <001f01c5240d$a920c8c0$0200a8c0@dell8200>
References: <001f01c5240d$a920c8c0$0200a8c0@dell8200>

On Tue, Mar 08, 2005 at 13:35:53 -0500,
  Rick Schumeyer <rschumeyer@ieee.org> wrote:
> I have two index questions.  The first is about an issue that has been
> recently discussed,
> 
> and I just wanted to be sure of my understanding.  Functions like count(),
> max(), etc. will
> 
> use sequential scans instead of index scans because the index doesn't know
> which rows
> 
> are actually visible.is this correct?

Not exactly. If the number of rows to be examined is on the order of 5%
of the table, an index scan will probably be slower than a sequential
scan. The visibility issue makes index scans slower in the case that
the only columns of interest are in the index.
Another issue is that max could in theory use an index, but there isn't
a mechanism for Postgres to know how to do this in general for aggregates
where it is possible. There have been discussions in the past about
how this could be done, but no one has done it yet.



view thread (12+ messages)  latest in thread

Message-ID: <20050309043821.GA1569@wolff.to>
Permalink:  ../20050309043821.GA1569@wolff.to/
Also on:    postgresql.org/message-id/20050309043821.GA1569@wolff.to

 · 

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: bruno@wolff.to, rschumeyer@ieee.org
  Subject: Re: index scan on =, but not < ?
  In-Reply-To: <20050309043821.GA1569@wolff.to>

* 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