[ZODB-Dev] Huge Disk usage

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 5 Dec 2002 08:46:46 +0000


On Thursday 05 December 2002 4:50 am, Joerg H. Baach wrote:
> 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,=20

That is 160 bytes per object. Are you questioning why the file is so larg=
e, or=20
so small?

> even though it seems
> the db just holds 10000 items?

Each persistent object is more than your 25 (or 24!) bytes of user data. =
It=20
also stores the oid, the textual names '__main__.TheClass', 'text', and '=
id',=20
plus an integer (your 'i'), plus other overheads of the pickle format. (Y=
ou=20
could reduce this by defining a __getstate__ method)

Plus you are storing the root object. It contains a reference to those 10=
,000=20
data objects, and itself therefore probably 140k in size


> I am new to ZODB (and Python), and trying out to see how things work.

The file is probably very regular in appearance, and therefore quite read=
able.=20
I suggest you look at its content to get a feel for what is going on.