Re: materialized view - Mailing list pgsql-general

From Jeremy Semeiks
Subject Re: materialized view
Date
Msg-id 20040901213253.GC2730@farviolet.farviolet.com
Whole thread Raw
In response to materialized view  ("Esteban Kemp" <ekemp@inf.uach.cl>)
List pgsql-general
On Wed, Sep 01, 2004 at 05:09:06PM -0400, Esteban Kemp wrote:
>  PostgreSql support materialized views ???
>
> if not, there is something similar??

Hi Esteban,

Postgres doesn't support materialized views, although I think there was
some talk of implementing them a few months ago. Try searching
pgsql.ru about this.

There are several possible present alternatives, depending on your
situation. First off, if your query on a view is running too slowly,
look into optimizing the query itself to make it as fast as possible.
If it's still too slow, and if either your data are relatively static
or you don't need up-to-the-minute accuracy, the simplest solution is
probably to just turn the view into a static table via "create table t as
select * from v", then update that table periodically. This usually
works well enough for my needs.

If you need up-to-the-minute accuracy, you could turn the view itself
into a table, then create triggers or rules on the tables used by the
view to keep everything synched.

So the answer really depends on how the view is defined, what you
plan to use it for, and how often your database is updated.

- Jeremy

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: materialized view
Next
From: Daniel Schuchardt
Date:
Subject: Re: materialized view