Re: select count(*) is slow

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: select count(*) is slow
Дата
Msg-id 970586.1617715553@sss.pgh.pa.us
обсуждение исходный текст
Ответ на select count(*) is slow  (aditya desai <admad123@gmail.com>)
Ответы Re: select count(*) is slow
Список pgsql-performance
aditya desai <admad123@gmail.com> writes:
> Below query takes 12 seconds. We have an index on  postcode.

> select count(*) from table where postcode >= '00420' AND postcode <= '00500'

That query does not match this index:

> CREATE INDEX Table_i1
>     ON table  USING btree
>     ((postcode::numeric));

You could either change postcode to numeric, change all your queries
of this sort to include the cast explicitly, or make an index that
doesn't have a cast.

            regards, tom lane



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

Предыдущее
От: aditya desai
Дата:
Сообщение: Re: Substitute for synonym in Oracle after migration to postgres
Следующее
От: aditya desai
Дата:
Сообщение: Re: select count(*) is slow