BUG #8598: Row count estimates of partial indexes

From: marko(at)joh(dot)to
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #8598: Row count estimates of partial indexes
Date: 2013-11-17 12:58:18
Message-ID: E1Vi1ve-0005cP-Ax@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 8598
Logged by: Marko Tiikkaja
Email address: marko(at)joh(dot)to
PostgreSQL version: 9.1.9
Operating system: Linux
Description:

Hi,

We have the following partial index on a small subset of a larger table:

"index_transactions_transaction_balance_details" btree (transactionid)
WHERE NOT processed AND accountbalancesdailyid IS NOT NULL

However, querying with the WHERE clause completely ignores the
pg_class.reltuples value for the index:

=# EXPLAIN ANALYZE SELECT * FROM transactions WHERE NOT processed AND
accountbalancesdailyid IS NOT NULL;

QUERY PLAN

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Index Scan using index_transactions_transaction_balance_details on
transactions (cost=0.00..3883160.47 rows=66259403 width=130) (actual
time=0.033..18.268 rows=13962 loops=1)
Total runtime: 18.874 ms
(2 rows)

.. which makes for some silly joins when this index is part of a larger
query.

Is this expected on 9.1? Has this been fixed in more recent versions?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Grittner 2013-11-17 15:34:10 Re: BUG #8598: Row count estimates of partial indexes
Previous Message colin.wright 2013-11-16 18:33:45 BUG #8592: Windows Installer not setting locality