Re: BUG #13830: pg_table_size and pg_indexes_size
От | Tom Lane |
---|---|
Тема | Re: BUG #13830: pg_table_size and pg_indexes_size |
Дата | |
Msg-id | 2682.1450894971@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #13830: pg_table_size and pg_indexes_size (foggyglass@163.com) |
Ответы |
Re: BUG #13830: pg_table_size and pg_indexes_size
|
Список | pgsql-bugs |
foggyglass@163.com writes: > postgres=# create table b(id int); > CREATE TABLE > postgres=# create index b_idx on b(id); > CREATE INDEX > postgres=# select relname , pg_table_size(oid),pg_indexes_size(oid) > postgres-# from pg_class where relname in ('b','b_idx'); > relname | pg_table_size | pg_indexes_size > ---------+---------------+----------------- > b | 0 | 8192 > b_idx | 8192 | 0 > (2 rows) Seems fine to me. b is empty at this point, so it has size zero. btree indexes, on the other hand, never have size zero because their metapage is created immediately. b_idx has no indexes attached to it, so pg_indexes_size finds nothing to report on and returns zero for that. If you insert any actual data, the results change: regression=# insert into b values(33); INSERT 0 1 regression=# select relname , pg_table_size(oid),pg_indexes_size(oid) from pg_class where relname in ('b','b_idx'); relname | pg_table_size | pg_indexes_size ---------+---------------+----------------- b | 8192 | 16384 b_idx | 16384 | 0 (2 rows) which maybe looks a bit saner. regards, tom lane
В списке pgsql-bugs по дате отправления: