Re: Fwd: [SQL] i want small information regarding postgres

2012-01-08 Thread Alvaro Herrera

Excerpts from Samuel Gendler's message of lun ene 02 08:44:53 -0300 2012:
> would someone with the appropriate authority please unsubscribe this
> person's email address from this list so we don't all get a bounce message
> after every email we send to the list?  Thanks.

Just did it.  In the future, please email sysadm...@postgresql.org with
mailing list complaints, as I don't read this list (or indeed many
others)

-- 
Álvaro Herrera 
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] notes on materialized views

2012-01-08 Thread cc "maco" young
thanks for your write-up on mviews!


first, it seems the easiest implementation of mview is a simple RULE around
the INSERT, UPDATE, DELETE for a table.

this will not work in all instances and, performance-wise, is pretty
expensive.

on the other hand it is quite easy, requires no structural overhead, and no
triggers.


second, regarding what you call Lazy Materialized Views.  have done this
before by putting relevant info in a session-scoped temporary table.  using
a post transaction trigger, queried this for the rows of the data needed to
be melded with the mview.

not overly pretty, but quite workable.  as a caution, did this years ago in
Oracle and have not tried this particular trick in pg.  Oracle then and now
had autonomous functions, allowing dml in an independent session -
frequently a life savior - but do not remember if they were necessary.


third, to the best of my poor (romantic?) recollection, some of the things
that made mviews very cool were that they could be refreshed when you do a
select from them, and then if you haven't used them in a while the updates
discontinue automatically.  could specify refresh interval and schedule
automatic refreshes at night.  for me it was a combination of these
features that made them really special.

where I was using these, for example, information up to the last hour or so
was quite sufficient, so refreshes occurred no more than once an hour.
 this was very positive to overall performance.  refreshed at night
automatically.  a very nasty view with sums by group etc.