From: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
---|---|
To: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | mem context is not reset between extended stats |
Date: | 2021-09-15 20:09:28 |
Message-ID: | 20210915200928.GP831@telsasoft.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Memory allocation appeared be O(1) WRT the number of statistics objects, which
was not expected to me. This is true in v13 (and probably back to v10).
It seems to work fine to reset the memory context within the loop, so long as
the statslist is allocated in the parent context.
|DROP TABLE t; CREATE TABLE t AS SELECT i, i+1 AS a, i+2 AS b, i+3 AS c, i+4 AS d, i+5 AS e FROM generate_series(1,99999)i;
|SELECT format('CREATE STATISTICS sta%s (ndistinct) ON a,(1+b),(2+c),(3+d),(4+e) FROM t', a) FROM generate_series(1,9)a\gexec
|SET log_statement_stats=on; SET client_min_messages=debug; ANALYZE t;
|=> 369432 kB max resident size
|SELECT format('CREATE STATISTICS sta%s (ndistinct) ON a,b,c,d,e FROM t', a) FROM generate_series(1,33)a\gexec
|SET log_statement_stats=on; SET client_min_messages=debug; ANALYZE t;
|=> 1284368 kB max resident size
Attachment | Content-Type | Size |
---|---|---|
0001-stx-do-not-leak-memory-for-each-stats-obj.patch | text/x-diff | 1.6 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Jonah H. Harris | 2021-09-15 20:35:53 | Re: Hook for extensible parsing. |
Previous Message | Andres Freund | 2021-09-15 19:55:06 | Re: Hook for extensible parsing. |