By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,019 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,019 IT Pros & Developers. It's quick & easy.

Prepared queries

P: n/a
I'm converting an application to use the V3 protocol features in the 7.4
libpq. As I need to make a design choice regarding the use of prepared
statements, I'm wondering what ressources does a prepared statement use on
the server ? If I need to create several hundred in each backend, is there a
big memory overhead ? What's the time spent by the backend to find one
prepared statement into a list of several hundreds of them ?

TIA

cyril
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postgresql.org

Nov 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Cyril VELTER" <cy**********@metadys.com> writes:
I'm converting an application to use the V3 protocol features in the 7.4
libpq. As I need to make a design choice regarding the use of prepared
statements, I'm wondering what ressources does a prepared statement use on
the server ? If I need to create several hundred in each backend, is there a
big memory overhead ?
It'd depend on the complexity of the query plans, but I'd think order of a
few KB per query.
What's the time spent by the backend to find one
prepared statement into a list of several hundreds of them ?


The prepared queries are indexed by a hash table, so the lookup time
should be fairly constant independent of their number.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 22 '05 #2

P: n/a

Thanks for your answer. Is there any way to know at runtime the space
effectively occupied by all prepared statements in a backend ?

cyril

----- Original Message -----
From: "Tom Lane" <tg*@sss.pgh.pa.us>
To: "Cyril VELTER" <cy**********@metadys.com>
Cc: <pg***********@postgresql.org>
Sent: Thursday, February 12, 2004 12:12 AM
Subject: Re: [GENERAL] Prepared queries

"Cyril VELTER" <cy**********@metadys.com> writes:
I'm converting an application to use the V3 protocol features in the 7.4
libpq. As I need to make a design choice regarding the use of prepared
statements, I'm wondering what ressources does a prepared statement use on the server ? If I need to create several hundred in each backend, is there a big memory overhead ?


It'd depend on the complexity of the query plans, but I'd think order of a
few KB per query.
What's the time spent by the backend to find one
prepared statement into a list of several hundreds of them ?


The prepared queries are indexed by a hash table, so the lookup time
should be fairly constant independent of their number.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.