Re: Removing unneeded self joins - Mailing list pgsql-hackers

From David Rowley
Subject Re: Removing unneeded self joins
Date
Msg-id CAKJS1f85vtEVqTHReduJd-n2SOOPJDB-=a302HXtUFJ7LfcoGQ@mail.gmail.com
Whole thread Raw
In response to Re: Removing unneeded self joins  (Andres Freund <andres@anarazel.de>)
Responses Re: Removing unneeded self joins  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 17 May 2018 at 11:00, Andres Freund <andres@anarazel.de> wrote:
> Wonder if we shouldn't just cache an estimated relation size in the
> relcache entry till then. For planning purposes we don't need to be
> accurate, and usually activity that drastically expands relation size
> will trigger relcache activity before long. Currently there's plenty
> workloads where the lseeks(SEEK_END) show up pretty prominently.

While I'm in favour of speeding that up, I think we'd get complaints
if we used a stale value.  We could have uses pg_class.relpages all
along, but it would cause the planner to not work so well in face of
the relation changing size significantly between analyze runs.

FWIW the major case where that does show up is when generating a plan
for a partitioned table with many partitions then pruning all but a
few of them.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Removing unneeded self joins
Next
From: David Rowley
Date:
Subject: Re: Incorrect comment in get_partition_dispatch_recurse