tags:

views:

65

answers:

2

When experimenting with (embedded) Apache Derby DB, I noticed that a fresh database, with no tables in it, takes about 1.7 MB of disk space. It's quite a bit more than my common wisdom would expect.

Why is that? Are there significant differences in this between various database engines? Can this be controlled with some "block size" -like settings?

A: 

Why does an empty folder occupies 4KB of data i.e. in Windows?

I have this wild guess out of nowhere...

You said that it's embedded... So since it's embedded, the database itself will contain of the necessary information that it needs in properly handling the database, maybe information about user account information, and so on which in most server/network version of databases is usually handled by built-in databases and so on.. its EMBEDDED! just a thought!

ultrajohn
Because of the file system's block size. But how about databases?
Joonas Pulakka
+3  A: 

There will be differences between different database engines.

Generally, there will be all the metadata tables that are needed to track the real tables/views/whatever else can appear in the database when they're created, possibly some pre-allocated space ready for when tables are added or when transactions start occurring.

e.g. the model database for SQL Server (2000) occupies ~1.25MB of space, of which 0.5MB is empty. This DB is the basis for all other databases in SQL server.

Damien_The_Unbeliever
On top of that maybe the developers thought people would like to USE the database, so they reserve some empty space so they dont have to gro the db on the first table create ;)
TomTom
Ok, the fact that some of the space is just pre-allocated *empty* space, reserved for future use, explains a lot. Thanks!
Joonas Pulakka