Movatterモバイル変換
[0]ホーム
Pygresql / Postgresql Problem
Rod MacNeilrmacneil at interactdirect.com
Mon Apr 23 10:03:38 EDT 2001
Hi,I am fairly new to Python, Linux and Postgresqlso I'm hoping this problem is a simple mistakeon my part. I have been experimenting with some databaseprogramming using Python 1.5.2 and Postgresql 7.The Postgresql server is running on Redhat 7.I have been running the Python program on anotherRedhat 7 box.The Python program uses Pygresql 3.1 to make alot (many thousands) of simple queries to lookup values.I had this running on my desktop machine and noticed thatas the program runs, my machine got slower and slower.When I looked into this I found, at least I think I foundthat the amount of memory allocated to the python processclimbed steadily as it ran.This is a simple program I wrote to demonstrate this:-----------------------------------------------------------import pgdbconx =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 objecteach time, but I got the same result.This is process information I gathered at 1 minute intervalsusing the command ps -el | grep python: F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD000 R 600 1786 1580 27 74 0 - 2642 - pts/4 00:00:00python : initial000 R 600 1786 1580 14 79 0 - 3135 - pts/4 00:00:08python : after 1 minute000 R 600 1786 1580 14 77 0 - 3613 - pts/4 00:00:17python : after 2 minutes000 R 600 1786 1580 14 76 0 - 4095 - pts/4 00:00:25python : after 3 minutes000 R 600 1786 1580 14 73 0 - 4574 - pts/4 00:00:34python : after 4 minutes000 R 600 1786 1580 14 71 0 - 5056 - pts/4 00:00:43python : after 5 minutesHas 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 MacNeilrmacneil at interactdirect.com
More information about the Python-listmailing list
[8]ページ先頭