Hallo,
im Frequently Asked Questions (FAQ) for PostgreSQL
http://www.postgresql.org/docs/faqs.FAQ.html#item4.5
habe ich folgende gelesen:
4.5) How much database disk space is required to store data from a typical text file?
A PostgreSQL database may require up to five times the disk space to store data from a text file.
As an example, consider a file of 100,000 lines with an integer and text description on each line. Suppose the text string avergages twenty bytes in length. The flat file would be 2.8 MB. The size of the PostgreSQL database file containing this data can be estimated as 5.6 MB:
28 bytes: each row header (approximate)
+24 bytes: one int field and one text field
- 4 bytes: pointer on page to tuple
56 bytes per row
The data page size in PostgreSQL is 8192 bytes (8 KB), so:
8192 bytes per page
----------------------------- = 146 rows per database page (rounded down)
56 bytes per row100000 data rows
--------------------------- = 685 database pages (rounded up)
146 rows per page685 database pages * 8192 bytes per page = 5,611,520 bytes (5.6 MB)
Indexes do not require as much overhead, but do contain the data that is being indexed, so they can be large also.
NULLs are stored as bitmaps, so they use very little space.
Ich hätte gerne wissen, woher die 28 bytes in der Rechnung herkommen. Kann jemand mir vielleicht erklären?
vielen Dank!
gang