Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.
От | Kuntal Ghosh |
---|---|
Тема | Re: [HACKERS] Add pgstathashindex() to get hash index table statistics. |
Дата | |
Msg-id | CAGz5QCLKAvPC40FMa3pnG+QojOk9LPaChVki3GiyyTkmQiUm6w@mail.gmail.com обсуждение исходный текст |
Ответ на | [HACKERS] Add pgstathashindex() to get hash index table statistics. (Ashutosh Sharma <ashu.coek88@gmail.com>) |
Ответы |
Re: [HACKERS] Add pgstathashindex() to get hash index table statistics.
|
Список | pgsql-hackers |
On Wed, Dec 21, 2016 at 7:22 PM, Ashutosh Sharma <ashu.coek88@gmail.com> wrote: > Hi All, > > I have introduced a new function 'pgstathashindex()' inside pgstatuple > extension to view the statistics related to hash index table. > I think this feature is going to be helpful. I've some initial review for the patch. I've not applied the patch yet. + buf = ReadBufferExtended(rel, MAIN_FORKNUM, blkno, RBM_NORMAL, NULL); Use ReadBuffer() instead. + /* + * Let us ignore metapage and bitmap page when calculating + * free space percentage for tuples in a table. + */ + table_len = (stats.total_pages - 2) * BLCKSZ; + + free_percent = 100.0 * stats.free_space / table_len; I think the calculation for max available spcae is wrong here. You should subtract the page header and special area from the total page size. A check for non-zero denominator should be added while calculating the percentage. There can be multiple bitmap pages. Right? + values[10] = Float8GetDatum(free_percent); Some precision should be added. + <row> + <entry><structfield>ffactor</structfield></entry> + <entry><type>integer</type></entry> + <entry>Average number of tuples per bucket</entry> + </row> I feel that either the column name should be changed or it should just output how full the index method is in percentage. + </varlistentry> + + + <varlistentry> Please remove extra spaces. And, please add some test cases for regression tests. -- Thanks & Regards, Kuntal Ghosh EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: