Re: Index on View ? - Mailing list pgsql-sql

From Ian Harding
Subject Re: Index on View ?
Date
Msg-id 3ACCFD66.22D0240A@pakrat.com
Whole thread Raw
In response to Re: Index on View ?  ("Richard Huxton" <dev@archonet.com>)
List pgsql-sql
The Brand-X DBMS have 'indexed views' but in all their explanations I can't
see where they would be useful.  SQL Server 2000 creates a 'clustered index'
on the view, then lets you create other unclustered indexes in addition to
it.  Any time one of the source tables is updated, the clustered index needs
to be updated, which to me means instantiating the view, which means tons of
overhead.  They talk about it being handy if there are aggregates in the
view, but why not create a table to hold the aggregated data and updated
with a trigger/rule?

Richard Huxton wrote:

> From: "Keith Gray" <keith@heart.com.au>
>
> > Is it possible (feasible) to create an index on a view.
> >
> > We have a large table and a defined sub-set (view)
> > from this table, would it be possible to keep an index
> > of the sub-set.
>
> I don't think so - the view is basically just a select rule that rewrites
> queries based on it.
>
> Indexes on underlying tables should be used though. Difficult to suggest
> what indices you might need without knowing the view/tables/queries
> involved.
>
> - Richard Huxton
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster



pgsql-sql by date:

Previous
From: Richard
Date:
Subject: pg_dump and oid
Next
From: "Gordon A. Runkle"
Date:
Subject: Re: UNION in a VIEW?