pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Release memory allocated by dependency_degree
6+ messages / 1 participants
[nested] [flat]

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 16:20 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 16:20 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ad8a166ca86846ab691bd6dafc695e0f7dd96012

Modified Files
--------------
src/backend/statistics/dependencies.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 16:29 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 16:29 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/abb2f9144ba1b7ac806f3779f53ae2f6174cd2d9

Modified Files
--------------
src/backend/statistics/dependencies.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 16:40 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 16:40 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c0386f403a832f50d61fc7bb9bb265f7700273f3

Modified Files
--------------
src/backend/statistics/dependencies.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 16:47 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 16:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4185632e93c1552c5e70279f2de394cd17700549

Modified Files
--------------
src/backend/statistics/dependencies.c | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 16:53 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 16:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4487a7def3ae6efa79c545c3edc03ea97f446e36

Modified Files
--------------
src/backend/statistics/dependencies.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Release memory allocated by dependency_degree
@ 2021-09-23 17:01 Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Tomas Vondra @ 2021-09-23 17:01 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/d77e085afd52e9023075288ba95cf3280e273c2d

Modified Files
--------------
src/backend/statistics/dependencies.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2021-09-23 17:01 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-09-23 16:20 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>
2021-09-23 16:29 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>
2021-09-23 16:40 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>
2021-09-23 16:47 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>
2021-09-23 16:53 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>
2021-09-23 17:01 pgsql: Release memory allocated by dependency_degree Tomas Vondra <tomas.vondra@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox