Re: Index-only scans - Mailing list pgsql-hackers

From Greg Stark
Subject Re: Index-only scans
Date
Msg-id 407d949e0907141750t527843fak5e895c4f0fb9cf4a@mail.gmail.com
Whole thread Raw
In response to Re: Index-only scans  (Ron Mayer <rm_pg@cheapcomplexdevices.com>)
List pgsql-hackers
On Wed, Jul 15, 2009 at 1:21 AM, Ron Mayer<rm_pg@cheapcomplexdevices.com> wrote:
> Really?  I'd have thought that index is similar to materializing
> these views:
>  create view a_b as select aid,bid from manytomany order by aid,bid;
>  create view b_a as select bid,aid from manytomany order by bid,aid;
> Or perhaps
>  create view a_b as select aid,array_agg(bid) from manytomany group by aid;


How do any of these views help you answer a query like "select aid
from manytomany where bid in (subquery)"?

The last one could help you answer the dual of that but not without
rewriting the query quite heavily to use array operations. The first
two I'm puzzled how they're useful at all since unless you add indexes
to the materialized views they'll just contain a complete copy of the
original table -- the most they could help with is avoiding a sort but
they'll never be updatable so they'll rarely actually be usable.

--
greg
http://mit.edu/~gsstark/resume.pdf


pgsql-hackers by date:

Previous
From: Jeremy Kerr
Date:
Subject: Re: [PATCH 1/2 v3] [libpq] rework sigpipe-handling macros
Next
From: Robert Haas
Date:
Subject: hot standby - merged up to CVS HEAD