Re: BUG #5113: Postgres not scanning indexes

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: dan <dan(dot)boeriu(at)roost(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5113: Postgres not scanning indexes
Date: 2009-10-13 23:49:54
Message-ID: 20091013164158.X27653@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 13 Oct 2009, dan wrote:

> Let's say I have a table t with 5 columns c1 NOT NULL, c2 NOT NULL, c3, c4,
> c5
> and I have a UNIQUE index on (c1, c2) (remember c1 and c2 have a not null
> constraint)
>
> When I run the query:
> select c1,c2 from t
>
> I expect the explain to say index scan; instead it says table scan.
> The index has ALL the info I need and in my case is about 2% the size of the
> table.

The index is missing the visibility information, so right now the system
cannot run such a query over the index alone since it couldn't determine
if the row version is visible to your statement. That data is currently in
with the data in the table, so it ends up needing to go back and read the
rows from the main table. IIRC, there's been talk and some work around
supporting indexes with visibility info, but I think there might have been
some issues that needed to be worked out before that would work.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2009-10-13 23:50:11 Re: BUG #5113: Postgres not scanning indexes
Previous Message Michael Glaesemann 2009-10-13 23:44:02 Re: BUG #5113: Postgres not scanning indexes