Re: Postgres prepare statement caching issue in postgres command line - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Postgres prepare statement caching issue in postgres command line
Date
Msg-id f0a49017-164e-7ff7-edf8-ebdc35830ab7@aklaver.com
Whole thread Raw
In response to Postgres prepare statement caching issue in postgres command line  (Soumya Prasad Ukil <soumyo_ju@yahoo.co.in>)
Responses Re: Postgres prepare statement caching issue in postgres command line
List pgsql-general
On 5/22/21 1:25 PM, Soumya Prasad Ukil wrote:
> I have been using postgres prepare statement feature through JDBC. I 
> could see the same prepare statement multiple times, parsing is not 
> happening in postgres backend, which is expected. However I do the same 
> in psql command line, that does not happen. It goes to parsing every 
> time I execute
> 
> Using the following query:
> 
> postgres=> PREPARE parallel_execute1(text, text) AS insert into actor 
> (first_name, last_name) values ($1, $2);
> postgres=> PREPARE parallel_execute2(int, int) AS insert into film_actor 
> (actor_id, film_id) values($1, $2);
> postgres=> execute parallel_execute1;
> postgres=> execute parallel_execute2;

Where are the arguments for the parameters?

> 
> 
> I have executed both prepared statements 10 times. I could see every 
> time both queries went through parsing. How do I make sure that they do 
> not need parsing in command line? JDBC it works in expected manner. Same 
> code does not go for parsing each time. How can I have same behaviour in 
> pgsql command line?
> 

How are you determining the above?


-- 
Adrian Klaver
adrian.klaver@aklaver.com



pgsql-general by date:

Previous
From: Ron
Date:
Subject: Re: Postgres prepare statement caching issue in postgres command line
Next
From: Bryn Llewellyn
Date:
Subject: Re: The contents of the pg_timezone_names view bring some surprises