Re: Access to Row ID information in Functions

From: "Paul Ramsey" <pramsey(at)cleverelephant(dot)ca>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, "PostGIS Development Discussion" <postgis-devel(at)postgis(dot)refractions(dot)net>
Subject: Re: Access to Row ID information in Functions
Date: 2008-04-01 22:08:17
Message-ID: 30fe546d0804011508x73a7ddb4o67ebc212dd485cad@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks Tom,

Yes, we've discussed adding some kind of optional identity information
to the object, it remains a potential course of action.

Paul

On Tue, Apr 1, 2008 at 2:37 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Paul Ramsey" <pramsey(at)cleverelephant(dot)ca> writes:
> > The "optimized" form gets cached and retrieved from a memory context.
> > Each time the function is run within a statement it checks the cache,
> > and sees if one of its arguments are the same as the last time around.
> > If so, it uses the prepared version of that argument. If not, it
> > builds a new prepared version and caches that.
>
> > The key here is being able to check the identify of the arguments...
> > is this argument A the same as the one we processed last time? One way
> > is to do a memcmp. But it seems likely that PgSQL knows exactly
> > whether it is running a nested loop, or a literal, and could tell
> > somehow that argument A is the same with each call.
>
> Not really. Certainly there's no way that that information would
> propagate into function calls.
>
> In the special case where your argument is a literal constant, I think
> there is enough information available to detect that that's the case
> (look at get_fn_expr_argtype). But if it's not, there's no very good
> way to know whether it's the same as last time.
>
> Perhaps it would be worth changing your on-disk storage format to allow
> cheaper checking? For instance include a hash value.
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2008-04-01 22:40:24 column level privileges
Previous Message Tom Lane 2008-04-01 21:37:43 Re: Access to Row ID information in Functions