Re: hyrax vs. RelationBuildPartitionDesc

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: hyrax vs. RelationBuildPartitionDesc
Дата
Msg-id
20190313164232.GA5270@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Alvaro Herrera <alvherre@2ndquadrant.com>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Alvaro Herrera <alvherre@2ndquadrant.com>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Alvaro Herrera <alvherre@2ndquadrant.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Michael Paquier <michael@paquier.xyz>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Michael Paquier <michael@paquier.xyz>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <amitlangote09@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Andres Freund <andres@anarazel.de>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Andres Freund <andres@anarazel.de>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <amitlangote09@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Heikki Linnakangas <hlinnaka@iki.fi>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Andres Freund <andres@anarazel.de>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Andres Freund <andres@anarazel.de>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <amitlangote09@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <amitlangote09@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <amitlangote09@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Tom Lane <tgl@sss.pgh.pa.us>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
Re: hyrax vs. RelationBuildPartitionDesc Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Re: hyrax vs. RelationBuildPartitionDesc Robert Haas <robertmhaas@gmail.com>
On 2019-Mar-13, Robert Haas wrote:

> RelationBuildPartitionDesc() creates basically all of the data
> structures it needs and then copies them into rel->rd_pdcxt, which has
> always seemed a bit inefficient to me.  Another way to redesign this
> would be to have the function create a temporary context, do all of
> its work there, and then reparent the context under CacheMemoryContext
> at the end.  That means any leaks would go into a relatively
> long-lifespan context, but on the other hand you wouldn't leak into
> the same context a zillion times over, and you'd save the expense of
> copying everything.  I think that the biggest thing that is being
> copied around here is the partition bounds, so maybe the leak wouldn't
> amount to much, and we could also do things like list_free(inhoids) to
> make it a little tighter.

I remember going over this code's memory allocation strategy a bit to
avoid the copy while not incurring potential leaks CacheMemoryContext;
as I recall, my idea was to use two contexts, one of which is temporary
and used for any potentially leaky callees, and destroyed at the end of
the function, and the other contains the good stuff and is reparented to
CacheMemoryContext at the end.  So if you have any accidental leaks,
they don't affect a long-lived context.  You have to be mindful of not
calling leaky code when you're using the permanent one.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

В списке pgsql-hackers по дате отправления
От: Robert Haas
Дата:
От: Sergei Kornilov
Дата:
FAQ