[Helma-user] allowing NULL VALUES in foreign keys

Julian Tree julian.tree at gmail.com
Mon Aug 21 22:05:21 CEST 2006


Well two incidents lead to this conclusion. One is 3 years back, when  
working with a MySQL database that contain NULL foreign key column.   
The database was running very slow once the record reached 200,000,  
the CTO at the time eventally replaced all the NULL with zero and the  
system speed up.

Another is via recommendation via another friend who worked a  
financial institution. Setting a column to 0 or '' and not allow NULL  
almost help me eliminate a lot of unnecessary checking while  
programming.

I don't have to check
if(user_id == 0 or user_id == null)

I have not done performance benchmarks.


On Aug 20, 2006, at 4:49 PM, nighthawk wrote:

> On 8/20/06, Julian Tree <julian.tree at gmail.com> wrote:
>> [...] I was told
>> to NOT allow NULL values in any database columns, because it prevents
>> the column from beingporperly  indexed.
> [...]
>> How are everyone's handling NULL values on a foreign key? Is NOT NULL
>> column really unindexable? or am I worrying over nothing.  I am using
>> postgresql 8.1.x, BTW.
>
> I am using Postgresql (8.0 tho) at work aswell and during all the
> performance measuring/tuning I did I never noticed what you described.
> Where did you hear that columns with NULL values do not get indexed
> properly?
>
> +n
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user



More information about the Helma-user mailing list