pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Karsten Hilbert <Karsten.Hilbert@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Trigger on select?
Date: Wed, 3 Aug 2005 11:23:08 +0200
Message-ID: <20050803092307.GA2991@merkur.hilbert.loc> (raw)
In-Reply-To: <42F015E3.8070308@travelamericas.com>
References: <42F01AAF.6040903@actarg.com>
	<42F015E3.8070308@travelamericas.com>

On Tue, Aug 02, 2005 at 05:54:59PM -0700, Chris Travers wrote:

> >Hey, anyone know if it is possible to fire a trigger before a select?  
> >I'm considering creating some tables which contain data summarized 
> >from other tables as kind of a cache mechanism.  The hope is I can 
> >speed up some queries that get executed a lot (and are kind of slow) 
> >by maintaining data (like sums of big columns, for example).  I was 
> >all ready to go and then I discovered that trigger-before-select is 
> >not supported.  (Is it in any DB?)
> >
> >The idea is this:
> >
> >Any time I execute a query that would access the summary data, the 
> >"before select" trigger fires and goes out and builds any summary data 
> >missing from the summary table.
> 
> No.  You must instead generate a view.

And then it needs to be a materialized view of some sort
to achieve the caching he's after.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346



view thread (6+ messages)  latest in thread

Message-ID: <20050803092307.GA2991@merkur.hilbert.loc>
Permalink:  ../20050803092307.GA2991@merkur.hilbert.loc/
Also on:    postgresql.org/message-id/20050803092307.GA2991@merkur.hilbert.loc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Karsten.Hilbert@gmx.net
  Subject: Re: Trigger on select?
  In-Reply-To: <20050803092307.GA2991@merkur.hilbert.loc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox