Re: Transient plans versus the SPI API

From: Anssi Kääriäinen <anssi(dot)kaariainen(at)thl(dot)fi>
To: Hannu Krosing <hannu(at)2ndQuadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Transient plans versus the SPI API
Date: 2011-08-08 11:05:17
Message-ID: 4E3FC2ED.10406@thl.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 08/08/2011 01:07 PM, Hannu Krosing wrote:
> That is why I think it is best done in the main parser - it has to parse
> and analyse the query anyway and likely knows which constants are
> "arguments" to the query
As far as I understand the problem, the parsing must transform table
references to schema-qualified references. The table_foobar in "SELECT *
FROM table_foobar WHERE id = ?" is not enough to identify a table. Using
search_path, query_str as a key is one possibility, but the search_path
is likely to be different for each user, and this could result in the
same query being cached multiple times.

By the way, I checked current Git HEAD and pg_stat_statements seems to
not handle search_path correctly. For pg_stat_statements this is not
critical, but if the raw query string is used as plan cache key things
will obviously break...

- Anssi

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2011-08-08 12:47:28 Re: Yes, WaitLatch is vulnerable to weak-memory-ordering bugs
Previous Message Alexander Korotkov 2011-08-08 10:27:33 Compiler warnings with stringRelOpts (was WIP: Fast GiST index build)