Re: High memory usage with savepoints & encoding differences
От | Tom Lane |
---|---|
Тема | Re: High memory usage with savepoints & encoding differences |
Дата | |
Msg-id | 1762.1240013028@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | High memory usage with savepoints & encoding differences ("Dylan Adams" <dadams@bybaxter.com>) |
Список | pgsql-general |
"Dylan Adams" <dadams@bybaxter.com> 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
В списке pgsql-general по дате отправления: