Hi! When I tested simple query as following, backend process used much memory and not freed until the backend was finished. # This is reproduced on PostgreSQL8.3 (PostgreSQL8.3.6 - PostgreSQL8.3.12)
------- BEGIN; SAVEPOINT sp0; INSERT INTO tbl VALUES (1); RELEASE sp0; SAVEPOINT sp1; INSERT INTO tbl VALUES (1); RELEASE sp1; (repeats 10k) ROLLBACK; SELECT pg_sleep(10000); ------- I think this caused by following fix. http://archives.postgresql.org/pgsql-committers/2008-12/msg00100.php http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/postgres.c?r1=1.560&r2=1.561) Should "CopySnapshot()" be performed in MessageContext ? Attached simple pathch to solve it... Best regards, -- NTT OSS Center Tatsuhito Kasahara kasahara.tatsuh...@oss.ntt.co.jp
diff -rcN postgresql-8.3.12/src/backend/tcop/postgres.c postgresql-8.3.12_dev/src/backend/tcop/postgres.c *** postgresql-8.3.12/src/backend/tcop/postgres.c 2010-10-01 22:36:12.000000000 +0900 --- postgresql-8.3.12_dev/src/backend/tcop/postgres.c 2010-12-16 15:46:43.000000000 +0900 *************** *** 914,919 **** --- 914,921 ---- /* * Set up a snapshot if parse analysis/planning will need one. */ + oldcontext = MemoryContextSwitchTo(MessageContext); + if (analyze_requires_snapshot(parsetree)) { mySnapshot = CopySnapshot(GetTransactionSnapshot()); *************** *** 926,932 **** * Switch to appropriate context for constructing querytrees (again, * these must outlive the execution context). */ - oldcontext = MemoryContextSwitchTo(MessageContext); querytree_list = pg_analyze_and_rewrite(parsetree, query_string, NULL, 0); --- 928,933 ----
-- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs