[ZODB-Dev] How expensive are savepoints?

Christian Heimes christian at cheimes.de
Sat Jul 9 09:09:08 EDT 2005


How expensive and costly are savepoints? I wasn't able to find 
informations about it in the Zope docs. Are they as expensive as sub 
transactions or are they just using some CPU cycles?

I'm thinking about using savepoints in my migration code. The code is 
migrating a possible large amount of objects (hundreds up the tenth of 
thousands). I don't want the code to fail because the last object has an 
unicode decode issue.

Code example:

for ob in objs:
     savepoint = transaction.savepoint()
     try:
         migrate(ob)
     except ConflictError:
         raise
     except:
         log()
         savepoint.rollback()

If savepoints are costly I would create a new savepoint every 10 or 50 
objets.

Christian



More information about the ZODB-Dev mailing list