how to vacuum thru psycopg

Al Niessner <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <1244774794.3998.9.camel@charon>
I am using psycopg 2.0.8 and want to vacuum my postgresql database as I
fill it. I found out that some of what I am seeing performance wise is
the database needing to optimize for my queries and insertions. So, I
was told to vacuum it occasionally. So, I tried to do it in my program
as it grew. The error says it all:

  File
"/home/niessner/Projects/PictureLibrary/Source/PictureLibrary/Model/DB/PostgresqlWithPsycopg/actions.py", line 247, in transactionClose
    if len (ids) == 10**int(log10 (len (ids))): self.__execute("vacuum
full", close=False, query=False)
  File
"/home/niessner/Projects/PictureLibrary/Source/PictureLibrary/Model/DB/PostgresqlWithPsycopg/actions.py", line 92, in __execute
    self.__cursor.execute (command)
psycopg2.InternalError: VACUUM cannot run inside a transaction block


So, if I cannot do it with a cursor, then how do I do it? I have 20000
large, complex items to add and time is growing linearly and will take
years to complete at its growth rate. However, if I can vacuum once in a
while, then I can keep the time down to finish in a week or two.

As always, thanks in advance for any and all help.

-- 
Al Niessner

I have never found the companion that was so companionable as solitude.
- From Walden by Henry David Thoreau

The universe is indifferent, and life is brutal; however, it is man's
choice of behavior that makes them malevolent rather than benevolent.

Some will fall in love with life and drink it from a fountain
That is pouring like an avalanche coming down the mountain.
- From the song Pepper by the Butthole Surfers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.