[ZODB-Dev] Huge Disk usage

Joerg H. Baach info@baach.de
05 Dec 2002 15:50:02 +1100


Hi,

I am new to ZODB (and Python), and trying out to see how things work. My
little testscript creates 10000 Objects, which carry about 25 bytes of
userdata.

a) While does the datafile actually consume 1.6 MB on the first run
b) Increases by the same 1.6 MB for each extra run, even though it seems
the db just holds 10000 items?

Thanks a lot,

  Joerg

P.S: Please send a reply (also) to info@baach.de

======= zo3.py ================import ZODB
from ZODB import FileStorage, DB
from ZODB.PersistentMapping import PersistentMapping
from Persistence import Persistent

storage = FileStorage.FileStorage('zo3.fs')
db = DB( storage )
conn = db.open()
dbroot = conn.root()

class TheClass (Persistent):
    pass

if not dbroot.has_key('db'):
    dbroot['db']= PersistentMapping()
db = dbroot['db']


for i in range (10000):
    obj = TheClass()
    obj.id = i
    obj.text = "These are 24 characters!"
    db[i] = obj
get_transaction().commit()

new = db[733]
print new.id
print new.text
print len(db)