> (In most cases NOT NULL DEFAULT xxx fields are BOOLEAN, flags: it is not
> handy to have 3-way flags.)

This is certainly not true for me.  I have both nullable booleans and
not-nullable, defaulted columns of other types.

> So, are there plans to optimize such kind of queries? This could be done by
> many ways:
>
> 1. Store the DEFAULT flag directly in NULL BITMAP (add a bit to NULL bitmap
> not only for NULLable fields, but also for NOT NULL DEFAULT ... fields).
> 2. Add another bitmap for each tuple (DEFAULT bitmap). Bit value 0 means
> that there is a real value in a cell, 1 - that the value is default.

Both of these options would expand storage usage by a not-inconsiderable amount.

> 3. The same as (1), but always force default value to be 0 (or false or any
> other values with meaning "zero") and optimize only these cases.

I'm not sure there's any way to know this for an arbitrary data type.

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to