Re: pg_class.relpages/allvisible probably shouldn't be a int4

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: pg_class.relpages/allvisible probably shouldn't be a int4
Date: 2014-05-09 20:50:24
Message-ID: d6f7dabf-08b3-465a-9713-a9eae06c6a43@email.android.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On May 9, 2014 10:37:49 PM CEST, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>Andres Freund <andres(at)2ndquadrant(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-05-09 21:16:48 Re: Weird behaviour with the new MOVE clause of ALTER TABLESPACE
Previous Message Tom Lane 2014-05-09 20:44:32 Re: default opclass for jsonb (was Re: Call for GIST/GIN/SP-GIST opclass documentation)