Re: How to troubleshoot high mem usage by postgres?
От | Chris |
---|---|
Тема | Re: How to troubleshoot high mem usage by postgres? |
Дата | |
Msg-id | 57033cf81002271717t6677b208v10679054673308d8@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: How to troubleshoot high mem usage by postgres? (Craig Ringer <craig@postnewspapers.com.au>) |
Список | pgsql-performance |
On Sat, Feb 27, 2010 at 3:38 PM, Craig Ringer <craig@postnewspapers.com.au> wrote: > Can you boil this down to a simple PHP test-case that connects to a dummy > database and repeats something that causes the backend to grow in memory > usage? Trying to do this - by progressively cutting things out of your test > until it stops growing - will help you track down what, exactly, is causing > the growth. Thank you for your suggestion. I have done this, and in doing so I have also discovered why this problem is occurring. My application uses a class that abstracts away the db interaction, so I do not normally use the pg_* functions directly. Any time any statement was executed, it created a new "named" prepared statement. I wrongly assumed that calling pg_free_result() on the statement resource would free this prepared statement inside of postgres. I will simply modify the class to use an empty statement name if there is no need for it to be named (which I actually need very infrequently anyway). I have attached the script I created to test with, for those who are interested. The first line of the script has the connection string. I used a db called testdb. run from the command line with: php -f test3.php Note my comment in the php file <<<<<< UNCOMMENT THIS LINE AND MEMORY ISSUE IS FIXED Thanks for the help everyone. Chris
Вложения
В списке pgsql-performance по дате отправления: