Re: [GENERAL] Boolean type storage format
On Wed, Oct 31, 2012 at 8:08 PM, Raghavendra wrote: > False represented by zero bytes and True by 1 byte with value 1. This is not true AFAIK. Both boolean TRUE and FALSE values require 1 byte. A NULL value is zero bytes (though it still consumes 1 bit in the null bitmap). This is true for all types, not just boolean. Regards, Marti -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Boolean type storage format
On 11/01/2012 02:25 AM, Mike Christensen wrote: > It would also matter what columns were next to it, correct? It doesn't look like PostgreSQL packs booleans. It still matters what's next to it because of the alignment requirements of other data types, but you still have a minimum of one byte per boolean. See: regress=> SELECT pg_column_size( ROW('t'::boolean) ); pg_column_size 25 (1 row) regress=> SELECT pg_column_size( ROW('t'::boolean, 't'::boolean) ); pg_column_size 26 (1 row) regress=> SELECT pg_column_size( ROW('t'::boolean, 't'::boolean, 'f'::boolean, 't'::boolean) ); pg_column_size 28 (1 row) -- Craig Ringer -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Boolean type storage format
It would also matter what columns were next to it, correct? For example, if you had 4 bools in a row, that could also be 1 byte.. On Wed, Oct 31, 2012 at 11:08 AM, Raghavendra < raghavendra@enterprisedb.com> wrote: > On Wed, Oct 31, 2012 at 8:52 PM, Alexander Gataric wrote: > >> What is the data physically stored as for boolean type? I know that it is >> one byte but is it char, int, or something else? >> > > > False represented by zero bytes and True by 1 byte with value 1. > > --- > Regards, > Raghavendra > EnterpriseDB Corporation > Blog: http://raghavt.blogspot.com/ > >
Re: [GENERAL] Boolean type storage format
On Wed, Oct 31, 2012 at 8:52 PM, Alexander Gataric wrote: > What is the data physically stored as for boolean type? I know that it is > one byte but is it char, int, or something else? > False represented by zero bytes and True by 1 byte with value 1. --- Regards, Raghavendra EnterpriseDB Corporation Blog: http://raghavt.blogspot.com/
[GENERAL] Boolean type storage format
What is the data physically stored as for boolean type? I know that it is one byte but is it char, int, or something else? Sent from my smartphone