mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
357cbaaeae
Fujii Masao, reviewed by Kyotaro Horiguchi.
45 lines
2.0 KiB
Plaintext
45 lines
2.0 KiB
Plaintext
CREATE EXTENSION pgstattuple;
|
|
--
|
|
-- It's difficult to come up with platform-independent test cases for
|
|
-- the pgstattuple functions, but the results for empty tables and
|
|
-- indexes should be that.
|
|
--
|
|
create table test (a int primary key, b int[]);
|
|
select * from pgstattuple('test'::text);
|
|
table_len | tuple_count | tuple_len | tuple_percent | dead_tuple_count | dead_tuple_len | dead_tuple_percent | free_space | free_percent
|
|
-----------+-------------+-----------+---------------+------------------+----------------+--------------------+------------+--------------
|
|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
|
(1 row)
|
|
|
|
select * from pgstattuple('test'::regclass);
|
|
table_len | tuple_count | tuple_len | tuple_percent | dead_tuple_count | dead_tuple_len | dead_tuple_percent | free_space | free_percent
|
|
-----------+-------------+-----------+---------------+------------------+----------------+--------------------+------------+--------------
|
|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0
|
|
(1 row)
|
|
|
|
select * from pgstatindex('test_pkey');
|
|
version | tree_level | index_size | root_block_no | internal_pages | leaf_pages | empty_pages | deleted_pages | avg_leaf_density | leaf_fragmentation
|
|
---------+------------+------------+---------------+----------------+------------+-------------+---------------+------------------+--------------------
|
|
2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | NaN | NaN
|
|
(1 row)
|
|
|
|
select pg_relpages('test');
|
|
pg_relpages
|
|
-------------
|
|
0
|
|
(1 row)
|
|
|
|
select pg_relpages('test_pkey');
|
|
pg_relpages
|
|
-------------
|
|
1
|
|
(1 row)
|
|
|
|
create index test_ginidx on test using gin (b);
|
|
select * from pgstatginindex('test_ginidx');
|
|
version | pending_pages | pending_tuples
|
|
---------+---------------+----------------
|
|
1 | 0 | 0
|
|
(1 row)
|
|
|