Re: pg_class.relpages/allvisible probably shouldn't be a int4 - Mailing list pgsql-hackers

From Andres Freund
Subject Re: pg_class.relpages/allvisible probably shouldn't be a int4
Date
Msg-id d6f7dabf-08b3-465a-9713-a9eae06c6a43@email.android.com
Whole thread Raw
In response to Re: pg_class.relpages/allvisible probably shouldn't be a int4  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_class.relpages/allvisible probably shouldn't be a int4
List pgsql-hackers
On May 9, 2014 10:37:49 PM CEST, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>Andres Freund <andres@2ndquadrant.com> writes:
>> That's nothing for 9.4 anymore, but shouldn't we make
>pg_class.relpages
>> a int8 (sounds slightly better than float to me) or somesuch?
>
>No; those are really BlockNumbers, and have always been.  float4 would
>lose information and float8 or int8 would waste space.  If we had an
>unsigned int type it'd be better.  I suppose we could declare them as
>OID,
>but that would probably confuse people no end.

Well negative numbers aren't great either.  Although admittedly it's not yet affecting many...

I think the waste of storing 2*4 additional bytes isn't going to hurt much.
And adding a proper unsigned type doesn't sound like a small amount of work. Not to speak of overloading troubles....
I realize they are block numbers and casted in most places - that's why the overflow doesn't seem to cause too many
troubles.

Andres

-- 
Please excuse brevity and formatting - I am writing this on my mobile phone.

Andres Freund                       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation)
Next
From: Stephen Frost
Date:
Subject: Re: Weird behaviour with the new MOVE clause of ALTER TABLESPACE