Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-04 Thread Kurt Westerfeld
By the very definition of a prepared statement the query plan gets stored before the parameter values are known Is this true for all databases? It would seem to me that this approach would always lead to the wrong query plan, especially in the case I am testing where the selectivity is very

Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-04 Thread Radosław Smogura
Can You try ...BETWEEN ?::date and ?::date ... syntax or send statement causing problems? Kind regards, Radosław Smogura On Tue, 04 Jan 2011 07:27:42 -0700, Kurt Westerfeld kwesterf...@novell.com wrote: By the very definition of a prepared statement the query plan gets stored before the

Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-04 Thread Kurt Westerfeld
First, sorry I didn't mention that I am using PostgreSQL 9, but the problem existed also on 8.4. As for the BETWEEN clause, I'm using hibernate and don't want to put a database-specific SQL query in place. I also decided to drop a few indexes, which were probably causing the optimizer to

Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-04 Thread Bill Moran
In response to Kurt Westerfeld kwesterf...@novell.com: Radosław Smogurarsmog...@softperience.eu 1/4/2011 9:48 AM Can You try ...BETWEEN ?::date and ?::date ... syntax or send statement causing problems? As for the BETWEEN clause, I'm using hibernate and don't want to put a

[GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-03 Thread Kurt Westerfeld
I have a JDBC-based application which passes date/time parameters using JDBC query parameters, which is performing very badly (ie. doing full table scans). In an effort to try to narrow down the problem, I am taking the query and running it in interactive SQL mode, but changing the date

Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-03 Thread bricklen
On Mon, Jan 3, 2011 at 2:48 PM, Kurt Westerfeld kwesterf...@novell.com wrote: I have a JDBC-based application which passes date/time parameters using JDBC query parameters, which is performing very badly (ie. doing full table scans).  In an effort to try to narrow down the problem, I am taking

Re: [GENERAL] Date Parameter To Query Confusing Optimizer

2011-01-03 Thread Alban Hertroys
On 3 Jan 2011, at 23:48, Kurt Westerfeld wrote: I have a JDBC-based application which passes date/time parameters using JDBC query parameters, which is performing very badly (ie. doing full table scans). In an effort to try to narrow down the problem, I am taking the query and running it