Skip site navigation (1) Skip section navigation (2)

Re: [WIP] Caching constant stable expressions per execution

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] Caching constant stable expressions per execution
Date: 2011-09-11 01:53:18
Message-ID: CABRT9RBfCGvR6p3DHfW9wOk+_7j34Wn4i=nTfGeo-y=R1rz9xg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On Sun, Sep 11, 2011 at 01:51, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Usually what people have meant when they ask for "function caching"
> is that multiple executions of a given stable function with the same
> argument values be folded to just one execution. In the general case
> that would require some sort of hash table

Right, this is more like execution-time constant folding. But I
decided not to call it that since I'm not "folding" the expression.

I know some people are writing queries like ts>=(SELECT now()-interval
'10 days') just to cache the single value from the expression.

> What you've done here is to solve the problem for the special case of
> a single (textual) instance of the function called with
> plan-time-constant arguments.

With a small tweak it can also support functions whose arguments are
(prepared query) placeholder variables.

> The patch as given has a bunch of implementation issues

This is my first patch that touches the more complicated internals of
Postgres. I'm sure I have a lot to learn. :)

Regards,
Marti

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2011-09-11 02:18:44
Subject: Re: ts_rank
Previous:From: Josh BerkusDate: 2011-09-11 01:46:57
Subject: Re: [WIP] Caching constant stable expressions per execution

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group