From: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
To: Serge Rielau <serge@rielau.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Doug Doole <ddoole@salesforce.com>
Subject: Re: Cached plans and statement generalization
Date: Tue, 25 Apr 2017 23:47:44 +0300
Message-ID: <58FFB5F0.2020900@postgrespro.ru> (raw)
In-Reply-To: <C0064A85-7CE9-44E6-B14F-98E541B328FD@rielau.com>
References: <8e76d8fc-8b8c-14bd-d4d1-e9cf193a74f5@postgrespro.ru>
<20170424184353.u2krt2eiw2l6e2af@alap3.anarazel.de>
<f0bfcdd6-dba3-e9a8-2108-146e1f880839@postgrespro.ru>
<CBF37923-CDA5-48EF-9E9E-4A338D7988ED@rielau.com>
<1f4c1a22-ecbe-811d-4695-ee4701b8f6c7@postgrespro.ru>
<e85343e6-5ab5-447c-9995-5cce992fedf3@rielau.com>
<58FFB391.5080101@postgrespro.ru>
<C0064A85-7CE9-44E6-B14F-98E541B328FD@rielau.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 04/25/2017 11:40 PM, Serge Rielau wrote:
>
>> On Apr 25, 2017, at 1:37 PM, Konstantin Knizhnik <k.knizhnik@postgrespro.ru <mailto:k.knizhnik@postgrespro.ru>> wrote:
>>>
>>>
>>> SELECT ‘hello’::CHAR(10) || ‘World’, 5 + 6;
>>>
>>> You can substitute ‘hello’, ‘World’, 5, and 6. But not 10.
>>
>> I am substituting only string literals. So the query above will be transformed to
>>
>> SELECT $1::CHAR(10) || $2, 5 + 6;
>>
>> What's wrong with it?
>
> Oh, well that leaves a lot of opportunities on the table, doesn’t it?
Well, actually my primary intention was not to make badly designed programs (not using prepared statements) work faster.
I wanted to address cases when it is not possible to use prepared statements.
If we want to substitute with parameters as much literals as possible, then parse+deparse tree seems to be the only reasonable approach.
I will try to implement it also, just to estimate parsing overhead.
>
> Cheers
> Serge
>
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: k.knizhnik@postgrespro.ru, serge@rielau.com, ddoole@salesforce.com
Subject: Re: Cached plans and statement generalization
In-Reply-To: <58FFB5F0.2020900@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox