From: | Ron Arts <ron(dot)arts(at)neonova(dot)nl> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | partial indexed not being used. |
Date: | 2007-02-12 00:23:13 |
Message-ID: | 45CFB371.8020805@neonova.nl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Anthony Carmody | 2007-02-12 01:12:21 | (no subject) |
Previous Message | Jan Danielsson | 2007-02-11 18:46:46 | Selecting non-existing rows? |