Re: Proposal: Improve bitmap costing for lossy pages

Amul Sul <sulamul@gmail.com>

From: amul sul <sulamul@gmail.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Alexander Kuzmenkov <a.kuzmenkov@postgrespro.ru>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-11-09T08:55:24Z
Lists: pgsql-hackers
Hi Dilip,

v6 patch:
 42 +   /*
 43 +    * Estimate number of hashtable entries we can have within
maxbytes. This
 44 +    * estimates the hash cost as sizeof(PagetableEntry).
 45 +    */
 46 +   nbuckets = maxbytes /
 47 +       (sizeof(PagetableEntry) + sizeof(Pointer) + sizeof(Pointer));

It took me a little while to understand this calculation.  You have moved this
code from tbm_create(), but I think you should move the following
comment as well:

tidbitmap.c:
 276     /*
 277      * Estimate number of hashtable entries we can have within
maxbytes. This
 278      * estimates the hash cost as sizeof(PagetableEntry), which
is good enough
 279      * for our purpose.  Also count an extra Pointer per entry
for the arrays
 280      * created during iteration readout.
 281      */

Regards,
Amul


Commits

  1. Account for the effect of lossy pages when costing bitmap scans.