Why does a simple query not use an obvious index?

Поиск
Список
Период
Сортировка
От Jack Kerkhof
Тема Why does a simple query not use an obvious index?
Дата
Msg-id ENEIKKAEJOFHOIHMMOIDIEBMJCAA.jack.kerkhof@guest-tek.com
обсуждение исходный текст
Ответы Re: Why does a simple query not use an obvious index?  (Mr Pink <mr_pink_is_the_only_pro@yahoo.com>)
Re: Why does a simple query not use an obvious index?  ("Scott Marlowe" <smarlowe@qwest.net>)
Список pgsql-performance
The query:

    select count(*) from billing where timestamp > now()-60

should obviously use the index

    CREATE INDEX billing_timestamp_idx ON billing USING btree ("timestamp" timestamp_ops);

on a table with 1400000 rows.

But it uses a Seq Scan. If I set enable_seqscan=no, it indicates a queryplan could not be calculated.

Why does this simple query not use the timestamp index, and how can I get it to?

Thanks, Jack

Jack Kerkhof
Research & Development
jack.kerkhof@guest-tek.com
www.guest-tek.com
1.866.509.1010 3480

Guest-Tek is a leading provider of broadband technology solutions for the hospitality industry. Guest-Tek's GlobalSuite™ high-speed Internet solution enables hotels to offer their guests the convenience of wired and/or wireless broadband Internet access from guest rooms, meeting rooms and public areas.

 

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

Предыдущее
От: Mischa Sandberg
Дата:
Сообщение: Re: Equivalent praxis to CLUSTERED INDEX?
Следующее
От: Mischa Sandberg
Дата:
Сообщение: Re: Equivalent praxis to CLUSTERED INDEX?