Re: Query about index usage

From: Greg Smith <greg(at)2ndquadrant(dot)com>
To: Jayadevan M <Jayadevan(dot)Maymala(at)ibsplc(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query about index usage
Date: 2010-06-11 15:32:13
Message-ID: 4C1256FD.6070707@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Jayadevan M wrote:
> One query about PostgreSQL's index usage. If I select just one column on
> which there is an index (or select only columns on which there is an
> index), and the index is used by PostgreSQL, does PostgreSQL avoid table
> access if possible?

PostgreSQL keeps information about what rows are visible or not in with
the row data. It's therefore impossible at this time for it to answer
queries just based on what's in an index. Once candidate rows are found
using one, the database must then also retrieve the row(s) and do a
second check as to whether it's visible to the running transaction or
not before returning them to the client.

Improving this situation is high up on the list of things to improve in
PostgreSQL and the value of it recognized, it just hasn't been built yet.

--
Greg Smith 2ndQuadrant US Baltimore, MD
PostgreSQL Training, Services and Support
greg(at)2ndQuadrant(dot)com www.2ndQuadrant.us

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Crooke 2010-06-11 15:58:11 O/T: performance tuning cars
Previous Message Kevin Grittner 2010-06-11 15:25:15 Re: Query about index usage