Re: High CPU usage after partitioning

Поиск
Список
Период
Сортировка
От rudi
Тема Re: High CPU usage after partitioning
Дата
Msg-id CAMxPiKEFHXnrpcfq6DxjAyrMXPMNUndtbxp+SouzfE3-LMZBwA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: High CPU usage after partitioning  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: High CPU usage after partitioning  (Igor Neyman <ineyman@perceptron.com>)
Список pgsql-performance
On Tue, Jan 22, 2013 at 3:46 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
The query is pretty simple and standard, the behaviour (and the plan) is totally different when it comes to a partitioned table.

Partioned table query => explain analyze SELECT  "sb_logs".* FROM "sb_logs"  WHERE (device_id = 901 AND date_taken = (SELECT MAX(date_taken) FROM sb_logs WHERE device_id = 901));


And there you have it. Constraint exclusion does not work in cases like this. It only works with static expressions (such as a literal date in this case).

Ok, but I would have expected same plant repeated 4 times. When the table is not partitioned, the plan is defintely smarter: it knows that index is reversed and looks for max with an index scan backward). When the table is partitioned, it scan forward and I guess it will always do a full index scan. 



--
rd

This is the way the world ends.
Not with a bang, but a whimper.

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: High CPU usage after partitioning
Следующее
От: Igor Neyman
Дата:
Сообщение: Re: High CPU usage after partitioning