git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 251c8e3) | patch
Rationalize use of list_concat + list_copy combinations.
2019年8月12日 15:20:18 +0000 (11:20 -0400)
2019年8月12日 15:20:18 +0000 (11:20 -0400)
commit 5ee190f8ec37c1bbfb3061e18304e155d600bc8e
Rationalize use of list_concat + list_copy combinations.

In the wake of commit 1cff1b95a, the result of list_concat no longer
shares the ListCells of the second input. Therefore, we can replace
"list_concat(x, list_copy(y))" with just "list_concat(x, y)".

To improve call sites that were list_copy'ing the first argument,
or both arguments, invent "list_concat_copy()" which produces a new
list sharing no ListCells with either input. (This is a bit faster
than "list_concat(list_copy(x), y)" because it makes the result list
the right size to start with.)

In call sites that were not list_copy'ing the second argument, the new
semantics mean that we are usually leaking the second List's storage,
since typically there is no remaining pointer to it. We considered
inventing another list_copy variant that would list_free the second
input, but concluded that for most call sites it isn't worth worrying
about, given the relative compactness of the new List representation.
(Note that in cases where such leakage would happen, the old code
already leaked the second List's header; so we're only discussing
the size of the leak not whether there is one. I did adjust two or
three places that had been troubling to free that header so that
they manually free the whole second List.)

Patch by me; thanks to David Rowley for review.

Discussion: https://postgr.es/m/11587.1550975080@sss.pgh.pa.us
26 files changed:
contrib/postgres_fdw/deparse.c diff | blob | blame | history
contrib/postgres_fdw/postgres_fdw.c diff | blob | blame | history
src/backend/commands/indexcmds.c diff | blob | blame | history
src/backend/executor/functions.c diff | blob | blame | history
src/backend/nodes/list.c diff | blob | blame | history
src/backend/optimizer/path/allpaths.c diff | blob | blame | history
src/backend/optimizer/path/costsize.c diff | blob | blame | history
src/backend/optimizer/path/indxpath.c diff | blob | blame | history
src/backend/optimizer/plan/createplan.c diff | blob | blame | history
src/backend/optimizer/plan/initsplan.c diff | blob | blame | history
src/backend/optimizer/plan/planner.c diff | blob | blame | history
src/backend/optimizer/plan/setrefs.c diff | blob | blame | history
src/backend/optimizer/prep/prepjointree.c diff | blob | blame | history
src/backend/optimizer/prep/prepqual.c diff | blob | blame | history
src/backend/optimizer/util/clauses.c diff | blob | blame | history
src/backend/optimizer/util/orclauses.c diff | blob | blame | history
src/backend/optimizer/util/relnode.c diff | blob | blame | history
src/backend/optimizer/util/tlist.c diff | blob | blame | history
src/backend/parser/parse_agg.c diff | blob | blame | history
src/backend/parser/parse_clause.c diff | blob | blame | history
src/backend/partitioning/partprune.c diff | blob | blame | history
src/backend/replication/syncrep.c diff | blob | blame | history
src/backend/rewrite/rewriteHandler.c diff | blob | blame | history
src/backend/utils/adt/ruleutils.c diff | blob | blame | history
src/backend/utils/adt/selfuncs.c diff | blob | blame | history
src/include/nodes/pg_list.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /