"Dylan Adams" <dadams@xxxxxxxxxxxx> writes: > I'm running into a situation where postmaster is consuming significantly > more memory than I would expect. This only seems to happen when I > combine savepoints with differences between client and database > encoding. I originally discovered this while running some Java code > which uses JDBC (the postgres JDBC driver always sets client_encoding to > UNICODE) to connect to a latin1 encoded database, but it's reproducible > with psql as well. I think this example is pretty artificial. The fundamental reason memory is increasing is that each subtransaction can require some state storage. In the example the per-subtransaction CurTransactionContexts are not getting used for anything except encoding conversion on the SAVEPOINT/RELEASE command completion messages --- but if you were doing any real work in the subtransactions then most likely there would be additional stuff there, so I'm not excited about trying to suppress this particular symptom. The bottom line is that lots and lots of subtransactions isn't a very good thing for performance, especially with a couple of network round trips for each one. Consider pushing whatever work is involved here into a server-side function. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general