Re: materialized view

From: Jeremy Semeiks <jrs(at)farviolet(dot)com>
To: Esteban Kemp <ekemp(at)inf(dot)uach(dot)cl>, pgsql-general(at)postgresql(dot)org
Subject: Re: materialized view
Date: 2004-09-01 21:32:53
Message-ID: 20040901213253.GC2730@farviolet.farviolet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-09-01 21:54:32 Re: Readline
Previous Message Scott Marlowe 2004-09-01 21:32:03 Re: materialized view