Re: Inconsistent use of relpages = -1

2024-10-25 Thread Jeff Davis
On Thu, 2024-10-24 at 05:01 +0300, Laurenz Albe wrote: > What you write above indicates that "relpages" = 0 and "reltuples" > > 0 > would also be acceptable. As Tom pointed out, that creates a risk that it's interpreted as infinite tuple denisity. The only functional change in my patch is to crea

Re: Inconsistent use of relpages = -1

2024-10-24 Thread Laurenz Albe
On Thu, 2024-10-24 at 08:03 -0700, Jeff Davis wrote: > On Thu, 2024-10-24 at 05:01 +0300, Laurenz Albe wrote: > > What you write above indicates that "relpages" = 0 and "reltuples" > > > 0 > > would also be acceptable. > > As Tom pointed out, that creates a risk that it's interpreted as > infinite

Re: Inconsistent use of relpages = -1

2024-10-24 Thread Laurenz Albe
On Wed, 2024-10-23 at 10:05 -0700, Jeff Davis wrote: > On Wed, 2024-10-23 at 04:47 +0200, Laurenz Albe wrote: > > On Tue, 2024-10-22 at 10:41 -0700, Jeff Davis wrote: > > > I attached a patch that creates partitioned tables with relpages=- > > > 1, > > > and updates the docs. > > > > Does this nee

Re: Inconsistent use of relpages = -1

2024-10-23 Thread Tom Lane
Jeff Davis writes: > It bothers me somewhat that views still have relpages=0, because they > also don't have storage. Thoughts? I think it's fine, because they also have reltuples=0. The combination of those two zeroes indicates ignorance as to the rel's contents. If either field is not zero, t

Re: Inconsistent use of relpages = -1

2024-10-23 Thread Jeff Davis
On Wed, 2024-10-23 at 04:47 +0200, Laurenz Albe wrote: > On Tue, 2024-10-22 at 10:41 -0700, Jeff Davis wrote: > > I attached a patch that creates partitioned tables with relpages=- > > 1, > > and updates the docs. > > Does this need any changes for pg_upgrade? pg_upgrade would go through the same

Re: Inconsistent use of relpages = -1

2024-10-22 Thread Laurenz Albe
On Tue, 2024-10-22 at 10:41 -0700, Jeff Davis wrote: > I attached a patch that creates partitioned tables with relpages=-1, > and updates the docs. Does this need any changes for pg_upgrade? Yours, Laurenz Albe

Re: Inconsistent use of relpages = -1

2024-10-22 Thread Jeff Davis
On Fri, 2024-10-18 at 15:14 -0400, Tom Lane wrote: > If we are going to put data into reltuples but not relpages, > I think I agree with setting relpages to -1 to signify > "unknown" (analogously to -1 for reltuples).  Otherwise it > looks like the table has infinite tuple density, which is > likel

Re: Inconsistent use of relpages = -1

2024-10-18 Thread Tom Lane
Jeff Davis writes: > As Corey discovered, and I re-discovered later, partitioned tables can > have relpages=-1: > ... > Another problem is that it's inconsistent: sometimes it's 0 (before > analyze) and sometimes -1. Views also don't have any storage, but > relpages are always 0. > ... > I don't s

Inconsistent use of relpages = -1

2024-10-18 Thread Jeff Davis
As Corey discovered, and I re-discovered later, partitioned tables can have relpages=-1: https://www.postgresql.org/message-id/f4a0cf7975f1ad42a20fcc91be9e938a4f71259d.ca...@j-davis.com One problem is that the code (analyze.c:680) is a bit unclear because it implicitly casts back and forth betwee