Re: Optimize query

Поиск
Список
Период
Сортировка
От Ron
Тема Re: Optimize query
Дата
Msg-id b29a815e-43cc-435e-36aa-224e7abf1739@gmail.com
обсуждение исходный текст
Ответ на Optimize query  (Yambu <hyambu@gmail.com>)
Список pgsql-general
On 12/15/20 8:17 AM, Yambu wrote:
Hi

How would you optimize a query with greater than in where clause eg

select * from table1 where id > 1000 

and there is an index on id column

The question as written is unanswerable.

- Why do you think it needs to be optimized?
- What is the table cardinality, and the query cardinality?
- What does EXPLAIN say?
- Have you run ANALYZE on table1?

Bottom line: Postgres might think that it is more efficient to scan the whole table.

--
Angular momentum makes the world go 'round.

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

Предыдущее
От: Raul Giucich
Дата:
Сообщение: Re: Optimize query
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: pg_ctl.exe deleted on abrupt shutdown of Windows