Skip site navigation (1) Skip section navigation (2)

Optimizing SQL: bind variables, prepared stms, histograms

From: <lnd(at)hnit(dot)is>
To: <pgsql-performance(at)postgresql(dot)org>
Subject: Optimizing SQL: bind variables, prepared stms, histograms
Date: 2004-01-23 17:06:30
Message-ID: 0A5B2E3C3A64CA4AB14F76DBCA76DDA44E2CED@seifur.hnit.is (view raw or flat)
Thread:
Lists: pgsql-performance

A few question regarding PostgreSQL handling of queries:

- Is each query submitted parsed and planned even if it is identical to a
query submitted before? 
For example, 10 queries "select * from animals where id=:b1" with possibly
different bind variable :b1 values will be fully processed (parsed and
planned) 10 times? 

- does it make difference for postgreSQL performance if bind variables are
used or not? 
Does it make difference in performance if the same prepared statement is used
just with different values of bind variables? 

- Does postgreSQL optimizer account for statistics like histograms when bind
variables are used (i.e. try to built a new plan given a concrete value of
bind variable)? 

Thank you in advance, 
Laimis



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

pgsql-performance by date

Next:From: Andrew SullivanDate: 2004-01-23 17:55:44
Subject: Re: High Performance/High Reliability File system on SuSE64
Previous:From: Joshua D. DrakeDate: 2004-01-23 16:51:03
Subject: Re: High Performance/High Reliability File system on SuSE64

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group