Re: speeding up planning with partitions

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: speeding up planning with partitions
Дата
Msg-id 2a531b7c-8ced-f868-2ef2-5cf33b92ef0f@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: speeding up planning with partitions  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: speeding up planning with partitions
Список pgsql-hackers
On 2019/03/28 14:03, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
>> On 2019/03/27 23:57, Tom Lane wrote:
>>> Yeah, there's something to be said for having plancat.c open each table
>>> *and store the Relation pointer in the RelOptInfo*, and then close that
>>> again at the end of planning rather than immediately.  If we can't avoid
>>> these retail table_opens without a great deal of pain, that's the
>>> direction I'd tend to go in.  However it would add some overhead, in
>>> the form of a need to traverse the RelOptInfo array an additional time.
> 
>> Just to be sure, do you mean we should do that now or later (David said
>> "in the long term")?
> 
> It's probably not high priority, though I wonder how much time is being
> eaten by the repeated table_opens.

It took me a couple of hours to confirm this, but it seems significantly
less than it takes to go over the simple_rel_array one more time to close
the relations.  The scan of simple_rel_array to close the relations needs
to be done once per query_planner() invocation, whereas I'd hoped this
could be done, say, in add_rtes_to_flat_rtable() that has to iterate over
the range table anyway.  That's because we call query_planner multiple
times on the same query in a few cases, viz. build_minmax_path(),
inheritance_planner().

Within query_planner(), table is opened in expand_inherited_rtentry(),
get_relation_constraints(), get_relation_data_width(), and
build_physical_tlist(), of which the first two are more common.  So, we
end up doing table_open() 3 times on average for any given relation, just
inside query_planner().

Thanks,
Amit




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

Предыдущее
От: "Nagaura, Ryohei"
Дата:
Сообщение: RE: Timeout parameters
Следующее
От: Michael Banck
Дата:
Сообщение: Re: Progress reporting for pg_verify_checksums