From: | Chris Travers <chris(at)travelamericas(dot)com> |
---|---|
To: | "Matt L(dot)" <survivedsushi(at)yahoo(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: booleans and nulls |
Date: | 2005-08-27 06:38:09 |
Message-ID: | 43100A51.1040602@travelamericas.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Matt L. wrote:
>Out of curiousity,
>
>1. Does a boolean column occupy 1byte of disk whether
>or not the value is null or not?
>
>
I believe so.
>2. Is matching on IS NULL or = 0 more efficient?
>
>
>
Hmm... = 0 is the same as IS FALSE. Not the same as IS NULL. So I
guess it is apples v. oranges....
>3. If I ix'd columns w/ null does postgres know
>whatevers not indexed is null or would their be no
>point?
>
>
>I currently utilize null fields as 'not a value' has
>meaning in a program i've been working on as I don't
>want to put false in every column when i only need a
>couple with a true/false value.
>
>I'm not joining tables on NULLS, just filtering w/
>them.
>
>
Sounds like a partial index would be your best bet. Something like:
CREATE index ON my_table WHERE my_bool IS NOT NULL
Best Wishes,
Chris Travers
Metatron Technology Consulting
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Travers | 2005-08-27 06:45:25 | Re: nullif('','') on insert |
Previous Message | Bruno Wolff III | 2005-08-27 06:14:55 | Re: returning inserted id |