From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_class.reltuples of brin indexes |
Date: | 2018-03-27 11:58:11 |
Message-ID: | CAD21AoAhLJHzFemh7BZ22s8uMDPOm67mp5TpHEVbi1Mi_eG9Zw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I found that pg_class.reltuples of brin indexes can be either the
number of index tuples or the number of heap tuples.
=# create table test as select generate_series(1,100000) as c;
=# create index test_brin on test using brin (c);
=# analyze test;
=# select relname, reltuples, relpages from pg_class where relname in
('test', 'test_brin');
relname | reltuples | relpages
-----------+-----------+----------
test | 100000 | 443
test_brin | 100000 | 3
(2 rows)
=# vacuum test;
=# select relname, reltuples, relpages from pg_class where relname in
('test', 'test_brin');
relname | reltuples | relpages
-----------+-----------+----------
test | 100000 | 443
test_brin | 3 | 3
(2 rows)
If I understand correctly pg_class.reltuples of indexes should have
the number of index tuples but especially for brin indexes it would be
hard to estimate it in the analyze code. I thought that we can change
brinvacuumcleanup so that it returns the estimated number of index
tuples and do vac_update_relstats using that value but it would break
API contract. Better ideas?
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2018-03-27 12:00:31 | Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation() |
Previous Message | Markus Winand | 2018-03-27 11:52:26 | XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated with wrong context |