From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | "\"Matthew V(dot)\" <" <linux4us(at)earthlink(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Effects of not using NOT NULL |
Date: | 2002-11-01 22:47:29 |
Message-ID: | 200211012247.gA1MlTG08241@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
PostgreSQL uses a bitmask to track NULL values. There is a bit for
every column in the row _if_ there are any nulls in the row, at least in
7.3beta. It does require a null indicator in client applications.
---------------------------------------------------------------------------
"Matthew V." < wrote:
> In DB2, when tables are created without using NOT NULL on columns, an
> extra byte is added to each record in the column as a NULL indicator flag.
> This byte is part of the data, and it exists for every occurrence of that
> field. (I think it's a byte--it might be two). This has the tendency to
> add a lot of space to the tablespace for maintaining the NULL indicator,
> and also imposes a requirement on embedded SQL applications of using a
> NULL indicator field when selecting/updating such fields. E.g.:
>
> EXEC SQL
> SELECT nullableField
> INTO :variabe:nullIndicator
> FROM table
> END-EXEC.
>
> where nullIndicator is defined as a binary field (short, PIC S9(04) COMP,
> etc) in the host language. A seperate variable must be used for each
> nullable field being selected.
>
> Does Postgresql include a similar NULL indicator flag on nullable fields,
> and if so, how big is it? Also, does that impose the restriction on
> embedded SQL of having a variable in which to store the null indicator
> flag?
>
> --
> Matthew Vanecek
> perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
Nice .sig:
$ perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
RTFM
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Hubert depesz Lubaczewski | 2002-11-01 23:42:13 | problems with building recent cvs snaphots |
Previous Message | Denis Braekhus | 2002-11-01 21:47:52 | Re: Norwegian Letters |