Fwd: extend statistics help reduce index scan a lot of shared buffer hits.

2024-02-27 Thread James Pang
Postgresql 14.8, Redhat8. looks like have to create extend statistics on indexed and joined columns to make join filters pushed down to secondary index scan in nestloop, and the shared buffer hits show big difference. is it expected ? SELECT

extend statistics help reduce index scan a lot of shared buffer hits.

2024-02-27 Thread James Pang
Postgresql 14.8, Redhat8. looks like have to create extend statistics on indexed and joined columns to make join filters pushed down to secondary index scan in nestloop, and the shared buffer hits show big difference. is it expected ? SELECT

Re: Optimizing count(), but Explain estimates wildly off

2024-02-27 Thread Alvaro Herrera
Hi Chema, On 2024-Feb-26, Chema wrote: > Dear pgsqlers, > > I'm trying to optimize simple queries on two tables (tenders & items) with > a couple million records. Besides the resulting records, the app also > displays the count of total results. Doing count() takes as much time as > the other