Optimize planner memory consumption for huge arrays

Поиск
Список
Период
Сортировка
От Lepikhov Andrei
Тема Optimize planner memory consumption for huge arrays
Дата
Msg-id em9939439a-441a-4b27-a977-ebdf5987dc49@7d14f008.com
обсуждение исходный текст
Ответы Re: Optimize planner memory consumption for huge arrays  (Dilip Kumar <dilipbalaut@gmail.com>)
Re: Optimize planner memory consumption for huge arrays  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Список pgsql-hackers
Hi, hackers,

Looking at the planner behaviour with the memory consumption patch [1], I figured out that arrays increase memory
consumptionby the optimizer significantly. See init.sql in attachment.
 
The point here is that the planner does small memory allocations for each element during estimation. As a result, it
lookslike the planner consumes about 250 bytes for each integer element.
 

It is maybe not a problem most of the time. However, in the case of partitions, memory consumption multiplies by each
partition.Such a corner case looks weird, but the fix is simple. So, why not?
 

The diff in the attachment is proof of concept showing how to reduce wasting of memory. Having benchmarked a bit, I
didn'tfind any overhead.
 

[1] Report planning memory in EXPLAIN ANALYZE
https://www.postgresql.org/message-id/flat/CAExHW5sZA=5LJ_ZPpRO-w09ck8z9p7eaYAqq3Ks9GDfhrxeWBw@mail.gmail.com

--
Regards,
Andrey Lepikhov

Вложения

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

Предыдущее
От: Dilip Kumar
Дата:
Сообщение: Re: Impact of checkpointer during pg_upgrade
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: Impact of checkpointer during pg_upgrade