Re: query result set caching

Lists: pgsql-general
From: Martin Sarsale <martin(at)emepe3(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: query result set caching
Date: 2004-08-04 20:06:11
Message-ID: 1091649971.12122.40.camel@kadaif
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dear All:

Im looking for solutions (Free Software is better) to do query result
caching.
Thanks to the people from #postgresql I know that postgres doesn't do
that by himself and the solution should be some kind of middle ware.

This is our problem: we are executing the same set of SELECT SP/queries
hundreds of times, without updating the DB. We would like to cache the
result of this SP/queries so the next time somebody runs one of them,
the results come from the cache instead of the db.

We would like to use an already developed and tested solution but if we
can't find anything that fits our needs, we can develop our own solution
(playing w/ PHP and PG's LISTEN/NOTIFY)

Thanks in advance


From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Martin Sarsale <martin(at)emepe3(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: query result set caching
Date: 2004-08-04 20:29:31
Message-ID: 20040804162931.10670935.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Martin Sarsale <martin(at)emepe3(dot)net> wrote:

> Dear All:
>
> Im looking for solutions (Free Software is better) to do query result
> caching.
> Thanks to the people from #postgresql I know that postgres doesn't do
> that by himself and the solution should be some kind of middle ware.
>
> This is our problem: we are executing the same set of SELECT SP/queries
> hundreds of times, without updating the DB. We would like to cache the
> result of this SP/queries so the next time somebody runs one of them,
> the results come from the cache instead of the db.
>
> We would like to use an already developed and tested solution but if we
> can't find anything that fits our needs, we can develop our own solution
> (playing w/ PHP and PG's LISTEN/NOTIFY)

There was a lot of talk about "materialized views" not too many months ago
on one of the PostgreSQL lists. I believe these techniques can accomplish
what you're looking for. An archive or google search should turn up
lots of info.

HTH.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com


From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Martin Sarsale <martin(at)emepe3(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: query result set caching
Date: 2004-08-05 01:30:57
Message-ID: 200408041830.57054.scrawford@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Wednesday 04 August 2004 1:06 pm, Martin Sarsale wrote:
> Dear All:
>
> Im looking for solutions (Free Software is better) to do query
> result caching.
> Thanks to the people from #postgresql I know that postgres doesn't
> do that by himself and the solution should be some kind of middle
> ware.
>
> This is our problem: we are executing the same set of SELECT
> SP/queries hundreds of times, without updating the DB. We would
> like to cache the result of this SP/queries so the next time
> somebody runs one of them, the results come from the cache instead
> of the db.

Possible kludge that may or may not help in your situation:

Can you create a table that is the result of your query and have the
front-end select from that? You could even create a trigger to update
the result table whenever the source table(s) are altered.

Cheers,
Steve