Re: Should heapam_estimate_rel_size consider fillfactor?

2023-07-03 Thread Tomas Vondra
On 7/3/23 11:40, Tomas Vondra wrote: > ... > > FWIW the reason why the integer division is intentional is most likely > that we want "floor" semantics - if there's 10.23 rows per page, that > really means 10 rows per page. > > I doubt it makes a huge difference in this particular place,

Re: Should heapam_estimate_rel_size consider fillfactor?

2023-07-03 Thread Tomas Vondra
On 7/3/23 09:00, Tomas Vondra wrote: > > > On 7/3/23 08:46, Peter Eisentraut wrote: >> On 14.06.23 20:41, Corey Huinker wrote: >>>     So maybe we should make table_block_relation_estimate_size smarter to >>>     also consider the fillfactor in the "no statistics" branch, per the >>>    

Re: Should heapam_estimate_rel_size consider fillfactor?

2023-07-03 Thread Tomas Vondra
On 7/3/23 08:46, Peter Eisentraut wrote: > On 14.06.23 20:41, Corey Huinker wrote: >>     So maybe we should make table_block_relation_estimate_size smarter to >>     also consider the fillfactor in the "no statistics" branch, per the >>     attached patch. >> >> >> I like this a lot. The

Re: Should heapam_estimate_rel_size consider fillfactor?

2023-07-03 Thread Peter Eisentraut
On 14.06.23 20:41, Corey Huinker wrote: So maybe we should make table_block_relation_estimate_size smarter to also consider the fillfactor in the "no statistics" branch, per the attached patch. I like this a lot. The reasoning is obvious, the fix is simple,it doesn't upset any

Re: Should heapam_estimate_rel_size consider fillfactor?

2023-06-14 Thread Andres Freund
Hi, On 2023-06-11 14:41:27 +0200, Tomas Vondra wrote: > While testing some stuff, I noticed heapam_estimate_rel_size (or rather > table_block_relation_estimate_size it calls) ignores fillfactor, so that > for a table without statistics it ends up with reltuple estimate much > higher than reality.

Re: Should heapam_estimate_rel_size consider fillfactor?

2023-06-14 Thread Corey Huinker
> > So maybe we should make table_block_relation_estimate_size smarter to > also consider the fillfactor in the "no statistics" branch, per the > attached patch. > I like this a lot. The reasoning is obvious, the fix is simple,it doesn't upset any make-check-world tests, and in order to get a

Should heapam_estimate_rel_size consider fillfactor?

2023-06-11 Thread Tomas Vondra
Hi, While testing some stuff, I noticed heapam_estimate_rel_size (or rather table_block_relation_estimate_size it calls) ignores fillfactor, so that for a table without statistics it ends up with reltuple estimate much higher than reality. For example, with fillfactor=10 the estimate is about 10x