Re: Patch : Global Prepared Statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: PFC <lists(at)peufeu(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch : Global Prepared Statements
Date: 2008-03-30 21:04:30
Message-ID: 28755.1206911070@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

PFC <lists(at)peufeu(dot)com> writes:
> Here is the result of my little experiment, for your viewing pleasure,

I'm having a problem with the terminology here, since AFAICT what your
patch does is exactly not a global "prepare" --- there is no permanently
stored cached plan. That's a good thing probably, but it seems like
the feature needs to be described differently.

I'm also pretty dubious about storing raw text in that catalog. In the
first place, while I've not looked at your patch, I expect you are
pulling the raw text from debug_query_string. That won't work in cases
where multiple SQL commands were submitted in one query string. In the
second place, raw-text SQL commands will be subject to a whole lot of
ambiguity at parse time. If for instance another session tries to use
the command with a different search_path or standard_conforming_string
setting, it'll get different results. While I can think of use-cases
for that sort of behavior, it seems like mostly a bad idea.

I'm thinking that a more appropriate representation would use stored
parse trees, the same as we do in pg_rewrite, and with the same
dependency information so that a stored statement couldn't outlive the
objects it depends on.

Another area that could do with more thought is the hard-wired
association between statement ownership and accessibility. That's
likely to be pretty inconvenient in a lot of cases, particularly
systems that use role membership heavily.

I also wonder whether statements should belong to schemas...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-03-30 21:09:17 Re: first time hacker ;) messing with prepared statements
Previous Message Tom Lane 2008-03-30 20:36:13 Re: Submission of Feature Request : RFC- for Implementing Transparent Data Encryption in Postgres