Reputation: 2676
How can i know details about an index on postgresql like how many nodes, and tree height?
It is possible to access the data structure itself?
i havent found any catalog tables that exposes such that detailed information
Thanks in advance!
Upvotes: 3
Views: 1543
Reputation: 463
You can use pgstattuple extension.
create extension pgstattuple;
SELECT * FROM pgstatindex('your_index_name');
For example,
ycsb=# select * from pgstatindex('usertable_pkey');
version | tree_level | index_size | root_block_no | internal_pages | leaf_pages | empty_pages | deleted_pages | avg_leaf_density | leaf_fragmentation
---------+------------+------------+---------------+----------------+------------+-------------+---------------+------------------+--------------------
2 | 3 | 5488721920 | 44337 | 4464 | 665545 | 0 | 0 | 52 | 11
(1 row)
You can refer to documentation; https://www.postgresql.org/docs/current/static/pgstattuple.html
Upvotes: 1
Reputation: 44177
See the bt_metap function in the pageinspect extension.
http://www.postgresql.org/docs/current/static/pageinspect.html
Upvotes: 2