Effects of not using NOT NULL

From: "Matthew V(dot)" < <linux4us(at)earthlink(dot)net>>
To: pgsql-general(at)postgresql(dot)org
Subject: Effects of not using NOT NULL
Date: 2002-10-30 03:36:42
Message-ID: etIv9.33301$iV1.3123@nwrddc02.gnilink.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ashish Lahori 2002-10-30 04:22:26 Re: Stream data into Postgres via Perl
Previous Message Bruno Wolff III 2002-10-30 02:41:43 Re: Bit srting manipulation question