]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Release memory allocated by dependency_degree
authorTomas Vondra <tomas.vondra@postgresql.org>
Mon, 20 Sep 2021 23:13:11 +0000 (01:13 +0200)
committerTomas Vondra <tomas.vondra@postgresql.org>
Thu, 23 Sep 2021 16:34:01 +0000 (18:34 +0200)
commitc0386f403a832f50d61fc7bb9bb265f7700273f3
tree0c8e33055cd516842f911cd0d9ff243ad497a2e5
parentb564eb0181e678ee58c1be2e9f3c53eeb68f8c4b
Release memory allocated by dependency_degree

Calculating degree of a functional dependency may allocate a lot of
memory - we have released mot of the explicitly allocated memory, but
e.g. detoasted varlena values were left behind. That may be an issue,
because we consider a lot of dependencies (all combinations), and the
detoasting may happen for each one again.

Fixed by calling dependency_degree() in a dedicated context, and
resetting it after each call. We only need the calculated dependency
degree, so we don't need to copy anything.

Backpatch to PostgreSQL 10, where extended statistics were introduced.

Backpatch-through: 10
Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com
src/backend/statistics/dependencies.c