[GENERAL] Optimizer produces wildly different row count estimate depending on casts

2004-03-08 Thread Shelby Cain
Standard cygwin Postgresql 7.4.1 package on Windows 2000 box. I have a relatively small table (about 1 million records) that contains inventory transaction data with an index on transaction date (date datatype). Since the data was inserted chronologically, the transaction date column is strongly

Re: [GENERAL] Optimizer produces wildly different row count estimate depending on casts

2004-03-08 Thread Tom Lane
Shelby Cain [EMAIL PROTECTED] writes: Consider the following queries: #1) explain analyze select txn_code, count(*) from inventory_txns where txn_date '07-FEB-2004' and txn_date = current_date group by txn_code; #2) explain analyze select txn_code, count(*) from inventory_txns where