Whatsit
Whatsit

Reputation: 10645

How to predict PostgreSQL index size

Is it possible to predict the amount of disk space/memory that will be used by a basic index in PostgreSQL 9.0?

E.g. If I have a default B-tree index on an integer column in a table of 1 million rows, how much space would be taken up by the index? Is the entire index held in memory at all times?

Upvotes: 4

Views: 1636

Answers (2)

Szymon Lipiński
Szymon Lipiński

Reputation: 28634

There is no way to say that. It depends on the type of operations you will make, as PostgreSQL stores many different versions of the same row, including row versions stored in index files.

Just make the table you are interested in and check it.

Upvotes: 2

Tyler Eaves
Tyler Eaves

Reputation: 13133

Not really a definitive answer, but I looked at a table in a 9.0 test system I have with a couple of int indexes on a table of 280k rows. The indexs all report a size of 6232kb. So roughly 22 bytes per row.

Upvotes: 4

Related Questions