Re: Tid scan improvements
David Rowley <david.rowley@2ndquadrant.com>
From: David Rowley <david.rowley@2ndquadrant.com>
To: Edmund Horner <ejrh00@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-03-14T10:06:01Z
Lists: pgsql-hackers
On Thu, 14 Mar 2019 at 21:12, Edmund Horner <ejrh00@gmail.com> wrote: > I'm not sure how an unreasonable underestimation would occur here. If > you have a table bloated to say 10x its minimal size, the estimator > still assumes an even distribution of tuples (I don't think we can do > much better than that). So the selectivity of "ctid >= <last ctid > that would exist without bloat>" is still going to be 0.9. Okay, think you're right there. I guess the only risk there is just varying tuple density per page, and that seems no greater risk than we have with the existing stats. Just looking again, I think the block of code starting: + if (density > 0.0) needs a comment to mention what it's doing. Perhaps: + /* + * Using the average tuples per page, calculate how far into + * the page the itemptr is likely to be and adjust block + * accordingly. + */ + if (density > 0.0) Or some better choice of words. With that done, I think 0001 is good to go. -- David Rowley http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Commits
-
Add TID Range Scans to support efficient scanning ranges of TIDs
- bb437f995d47 14.0 landed
-
Improve planner's selectivity estimates for inequalities on CTID.
- f7111f72d2fd 12.0 landed