Re: Query not using the index

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Query not using the index
Дата
Msg-id 20030225074450.A16284@mail.libertyrms.com
обсуждение исходный текст
Ответ на Query not using the index  (Mark Halliwell <mark@transportservices.com.au>)
Список pgsql-performance
On Tue, Feb 25, 2003 at 07:03:40PM +1100, Mark Halliwell wrote:

> The majority of records (about 6.8 million) have computer = 8 with sequence
> starting at 2200000 and incrementing by 1.
> There are about 497000 records with computer = 3 with the sequence starting at
> 1 and also incrementing by 1.
> There are only a few records with other computer numbers.

> select * from replicate where computer = 3 and sequence >= 490000;
>
> I have created several different indexes (always doing a vacuum analyse
> afterwards etc), but the explain always reports a sequential scan.  If I

Try setting the statistics on computer to a much wider value -- say

    ALTER TABLE computer ALTER COLUMN computer SET STATISTICS 1000

and see if it helps.  You can poke around in the pg_stats view to see
why this might help, and perhaps to get a more realistic idea of what
you need to set the statistics to.  The problem is likely the
overwhelming commonality of computer=8.

A

--
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110


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

Предыдущее
От: Mark Halliwell
Дата:
Сообщение: Query not using the index
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Query not using the index