partial indexed not being used.

Поиск
Список
Период
Сортировка
От Ron Arts
Тема partial indexed not being used.
Дата
Msg-id 45CFB371.8020805@neonova.nl
обсуждение исходный текст
Ответы Re: partial indexed not being used.
Список 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

Вложения

В списке pgsql-novice по дате отправления:

Предыдущее
От: Jan Danielsson
Дата:
Сообщение: Selecting non-existing rows?
Следующее
От: Anthony Carmody
Дата:
Сообщение: (no subject)