Pygresql / Postgresql Problem
Rod MacNeil
rmacneil at interactdirect.com
Mon Apr 23 10:03:38 EDT 2001
Hi,
I am fairly new to Python, Linux and Postgresql
so I'm hoping this problem is a simple mistake
on my part. I have been experimenting with some database
programming using Python 1.5.2 and Postgresql 7.
The Postgresql server is running on Redhat 7.
I have been running the Python program on another
Redhat 7 box.
The Python program uses Pygresql 3.1 to make a
lot (many thousands) of simple queries to lookup values.
I had this running on my desktop machine and noticed that
as the program runs, my machine got slower and slower.
When I looked into this I found, at least I think I found
that the amount of memory allocated to the python process
climbed steadily as it ran.
This is a simple program I wrote to demonstrate this:
-----------------------------------------------------------
import pgdb
conx =
pgdb.connect(host='192.168.1.101',user='blahblah',password='blahblah')
cur1 = conx.cursor()
for iter in range(500000):
sql="select * from mucw where word='%s'" % 'BOWL'
cur1.execute(sql)
data=cur1.fetchall()
cur1.close()
conx.close()
-------------------------------------------------------------
I also coded this to delete and recreate the cursor object
each time, but I got the same result.
This is process information I gathered at 1 minute intervals
using the command ps -el | grep python:
F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD
000 R 600 1786 1580 27 74 0 - 2642 - pts/4 00:00:00
python : initial
000 R 600 1786 1580 14 79 0 - 3135 - pts/4 00:00:08
python : after 1 minute
000 R 600 1786 1580 14 77 0 - 3613 - pts/4 00:00:17
python : after 2 minutes
000 R 600 1786 1580 14 76 0 - 4095 - pts/4 00:00:25
python : after 3 minutes
000 R 600 1786 1580 14 73 0 - 4574 - pts/4 00:00:34
python : after 4 minutes
000 R 600 1786 1580 14 71 0 - 5056 - pts/4 00:00:43
python : after 5 minutes
Has anyone else had this problem?
Is this indicative of a memory leak in Pygresql?
Am I using Pygres incorrectly in some way?
Thanks in advance for any assistance you can offer, its appreciated.
Rod MacNeil
rmacneil at interactdirect.com
More information about the Python-list
mailing list