Peter Eisentraut <peter_e@gmx.net> writes:
> Mike Mascari writes:
>> Well, I basically implemented it as a result of this thread:
>> http://archives.postgresql.org/pgsql-general/2003-09/msg01347.php
> We've rejected session variables many times before because they duplicate
> temporary tables. I don't see anything new added by this proposal.
I should think there would be a notable performance advantage, since
one need not create a temp table (which in our current implementation is
just as expensive as creating a permanent table); not to mention
dropping the temp table later, vacuuming up the resulting dead rows in
pg_class and pg_attribute, etc. Whether that advantage is great enough
to justify a nonstandard feature is unproven, but I imagine Mike could
answer it with a little experimentation.
I guess the main limitation that I see in this proposal is that it can
only handle a single variable datatype (namely text). In a temp-table
design you can of course make the column datatype(s) whatever you need.
This objection could perhaps be answered just by making the function
names be get_session_variable_text() and set_session_variable_text(),
to leave room for variants for other data types.
regards, tom lane