Re: Effects of not using NOT NULL

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Effects of not using NOT NULL
Дата
Msg-id 200211012247.gA1MlTG08241@candle.pha.pa.us
обсуждение исходный текст
Ответ на Effects of not using NOT NULL  ("Matthew V." < <linux4us@earthlink.net>>)
Список 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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

В списке pgsql-general по дате отправления:

Предыдущее
От: Denis Braekhus
Дата:
Сообщение: Re: Norwegian Letters
Следующее
От: "Roderick A. Anderson"
Дата:
Сообщение: Re: [Q] Sequences, last_value and inserts