pgsql: Optimize generate_orderedappend_paths

Поиск
Список
Период
Сортировка
От David Rowley
Тема pgsql: Optimize generate_orderedappend_paths
Дата
Msg-id E1pU2op-00246F-Um@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Optimize generate_orderedappend_paths

In generate_orderedappend_paths(), when match_partition_order_desc was
true, we would lcons() items to various lists in a loop over each live
partition.  When the number of live partitions was large, the lcons()
could show up in profiles due to it having to perform memmove() to make
way for the new list item.

Here we adjust things so that we just perform the loop over the live
partitions backwards when match_partition_order_desc is true.  This allows
us to simplify the logic in the loop.  Now, as far as the guts of the loop
knows, there's no difference between match_partition_order and
match_partition_order_desc.  We can just set match_partition_order to true
so that we build the correct list of paths for the asc and desc case. Per
idea from Andres Freund.

Discussion: https://postgr.es/m/20230217002351.nyt4y5tdzg6hugdt@awork3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/94cad7a3e6040e23d51b9d4869fc20e3e56ddbf7

Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 57 +++++++++++++++++++++--------------
1 file changed, 34 insertions(+), 23 deletions(-)


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

Предыдущее
От: John Naylor
Дата:
Сообщение: pgsql: Add MSVC support for pg_leftmost_one_pos32() and friends
Следующее
От: Alvaro Herrera
Дата:
Сообщение: pgsql: Correctly set userid of subquery relations' child rels