Hello
I have a table that has a boolean column telling if that particular
record has been billed already. So most of the time that column holds
only true values.
To select the unbilled record I use the following query:
# select * where billed = false order by calldate;
and defined the following index:
# Create index cdr_billed_index on cdr (billed) where billed = false;
This query took surprisingly long, and explain seems to be telling
me the query is using a sequential scan:
=# explain select cdr.* from cdr where billed = false order by calldate;
QUERY PLAN
-------------------------------------------------------------------
Sort (cost=37448.75..37526.94 rows=31273 width=465)
Sort Key: calldate
-> Seq Scan on cdr (cost=0.00..20323.81 rows=31273 width=465)
Filter: (billed = false)
How can I ensure the patial billing index will be used?
thanks for any insights,
Ron