Heikki Linnakangas wrote:
> ...
> CREATE TABLE manytomany (aid integer, bid integer);
> CREATE INDEX a_b ON manytomany (aid, bid);
> CREATE INDEX b_a ON manytomany (bid, aid);
> ...
>> new and interesting indexing strategies. Covered indexes are also one
>> kind of materialized view. It may be better to implement mat views and
>> gain wider benefits too.
>
> Materialized view sure would be nice, but doesn't address quite the same
> use cases. Doesn't help with the many-to-many example above, for
> example. We should have both.
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
manytomanyorder by bid,aid;
Or perhaps create view a_b as select aid,array_agg(bid) from manytomany group by aid;
But I like the index-only scan better anyway because I already have
the indexes so the benefit would come to me automatically rather than
having to pick and choose what views to materialize.