From: | Greg Stark <gsstark(at)mit(dot)edu> |
---|---|
To: | Neil Conway <neilc(at)samurai(dot)com> |
Cc: | Aaron Werman <awerman(at)hotmail(dot)com>, Scott Kirkwood <scottakirkwood(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Caching of Queries |
Date: | 2004-09-27 12:59:27 |
Message-ID: | 87fz5398b4.fsf@stark.xeocode.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Neil Conway <neilc(at)samurai(dot)com> writes:
> I think the conclusion of past discussions about this feature is that
> it's a bad idea. Last I checked, MySQL has to clear the *entire* query
> cache when a single DML statement modifying the table in question is
> issued. Not to mention that the feature is broken for non-deterministic
> queries (like now(), ORDER BY random(), or nextval('some_seq'), and so
> on). That makes the feature close to useless for a lot of situations,
> albeit not every situation.
Well there's no reason to assume that just because other implementations are
weak that postgres would have to slavishly copy them.
I've often wondered whether it would make sense to cache the intermediate
results in queries. Any time there's a Materialize node, the database is
storing all those data somewhere; it could note the plan and parameters that
generated the data and reuse them if it sees the same plan and parameters --
including keeping track of whether the source tables have changed or whether
there were any non-immutable functions of course.
This could be quite helpful as people often do a series of queries on the same
basic data. Things like calculating the total number of records matching the
user's query then fetching only the records that fit on the current page. Or
fetching records for a report then having to calculate subtotals and totals
for that same report. Or even generating multiple reports breaking down the
same data along different axes.
--
greg
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Kirkwood | 2004-09-27 13:00:14 | Re: Caching of Queries |
Previous Message | Mark Cotner | 2004-09-27 08:50:37 | Performance/Functional Analysis Complete |