Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 33E4C9FA220 for ; Wed, 17 Jan 2007 20:02:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 61285-05 for ; Wed, 17 Jan 2007 20:02:06 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by postgresql.org (Postfix) with ESMTP id 8D42E9F9FDA for ; Wed, 17 Jan 2007 20:02:06 -0400 (AST) Received: by nf-out-0910.google.com with SMTP id x4so28476nfb for ; Wed, 17 Jan 2007 16:02:05 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=KKj64eGSFcmQTQ7rNqvuuIbHeA/7itmO9X9bu73nvBj+vSznTL7QYY6QIfcJxXaqxxkabu84CGQV/JkIRnY2ProlaHaX/0xcwkwvr0D++0Ad88ugDRSD98MdfoAr+ht5v0q8uluBNhbnWWqDNk0Dk0ZLkVo0oGigjKlW47j/axM= Received: by 10.48.202.11 with SMTP id z11mr196810nff.1169078515501; Wed, 17 Jan 2007 16:01:55 -0800 (PST) Received: by 10.48.230.1 with HTTP; Wed, 17 Jan 2007 16:01:55 -0800 (PST) Message-ID: <81961ff50701171601n5ce08c2dq5b56729b59468448@mail.gmail.com> Date: Wed, 17 Jan 2007 19:01:55 -0500 From: "Chad Wagner" To: Steve Subject: Re: Configuration Advice Cc: pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_194140_25962670.1169078515427" References: <1168982580.8275.1169588211@webmail.messagingengine.com> <81961ff50701161444l3f932755m5a6e15ad2d948130@mail.gmail.com> <1169002739.19758.1169636285@webmail.messagingengine.com> <1169012767.6271.7.camel@localhost.localdomain> <1169044649.19974.1169715743@webmail.messagingengine.com> <1169050746.9586.44.camel@state.g2switchworks.com> <45AE79D5.9080000@fuzzy.cz> <81961ff50701171334t6bb6a402gc0d671643ffd714a@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/293 X-Sequence-Number: 22894 ------=_Part_194140_25962670.1169078515427 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/17/07, Steve wrote: > > However, I will look into this and see if I can figure out this > average value. This may be a valid idea, and I'll look some more at it. It must be, Oracle sells it pretty heavily as a data warehousing feature ;). Oracle calls it a materialized view, and the basic premise is you have a "change" log (called a materialized log by Oracle) and you have a job that runs through the change log and applies the changes to the materialized view. If you are using aggregates, be careful and make sure you use simple forms of those aggregates. For example, if you are using an "average" function then you should have two columns sum and count instead. Some aggregates are too complex and cannot be represented by this solution and you will find that you can't update the summary tables, so definitely try to stay away from complex aggregates if you do not need them. Here is a link to a PL/pgSQL effort that tries to simulate materialized views: http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html I don't know how complete it is, and it looks like there was a project started but has been abandoned for the last 3 years. -- Chad http://www.postgresqlforums.com/ ------=_Part_194140_25962670.1169078515427 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline On 1/17/07, Steve <cheetah@tanabi.org> wrote:
        However, I will look into this and see if I can figure out this
average value.  This may be a valid idea, and I'll look some more at it.

It must be, Oracle sells it pretty heavily as a data warehousing feature  ;).  Oracle calls it a materialized view, and the basic premise is you have a "change" log (called a materialized log by Oracle) and you have a job that runs through the change log and applies the changes to the materialized view.

If you are using aggregates, be careful and make sure you use simple forms of those aggregates.  For example, if you are using an "average" function then you should have two columns sum and count instead.  Some aggregates are too complex and cannot be represented by this solution and you will find that you can't update the summary tables, so definitely try to stay away from complex aggregates if you do not need them.

Here is a link to a PL/pgSQL effort that tries to simulate materialized views:

http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html

I don't know how complete it is, and it looks like there was a project started but has been abandoned for the last 3 years.

--
Chad
http://www.postgresqlforums.com/ ------=_Part_194140_25962670.1169078515427--