Re: Creating index on a view?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: "Net Virtual Mailing Lists" <mailinglists(at)net-virtual(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating index on a view?
Date: 2004-11-24 10:14:37
Message-ID: 200411241114.37119.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Net Virtual Mailing Lists wrote:
> My question is regarding creating an index on a view, or perhaps
> another way to accomplish this.

Views are just macro expansions of queries (in a manner of speaking).
To make queries on views use indexes, you create the indexes on the
underlying tables in the same way as if you had typed in the expanded
view query yourself. (In your example, you'd just need the usual
indexes on the primary keys.)

If what you want is that the creation of an index on a view
automatically materializes that view (don't other database systems do
that?), then you will have to implement that manually in PostgreSQL,
with triggers and a bunch of code.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-11-24 10:19:44 Re: Copying into Unicode - Correcting Errors
Previous Message Najib Abi Fadel 2004-11-24 10:07:53 Row creation time