Re: Query performance problem

From: Richard Huxton <dev(at)archonet(dot)com>
To: Kenneth Gonsalves <lawgon(at)thenilgiris(dot)com>
Cc: weberp(at)paradise(dot)net(dot)nz, pgsql-sql(at)postgresql(dot)org
Subject: Re: Query performance problem
Date: 2005-03-17 14:05:45
Message-ID: 42398EB9.2050707@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kenneth Gonsalves wrote:
> On Thursday 17 Mar 2005 1:50 pm, Phil Daintree wrote:
>
>
>>CREATE TABLE chartdetails (
>> accountcode integer DEFAULT 0 NOT NULL,
>> period integer DEFAULT 0 NOT NULL,
>> budget double precision DEFAULT (0)::double precision NOT NULL,
>> actual double precision DEFAULT (0)::double precision NOT NULL,
>> bfwd double precision DEFAULT (0)::double precision NOT NULL,
>> bfwdbudget double precision DEFAULT (0)::double precision NOT
>>NULL );
>
>
> although may be not relevant to your question, as i have noticed this
> before with mysql 'sql', what is the point of having a NOT NULL field
> that defaults to 0? the whole idea of a NOT NULL field is to have the
> value filled in compulsorily and having a default of 0 or '' defeats
> the purpose

Not necessarily. NOT NULL here helps to ensure you can add values
together without the risk of a null result. There are plenty of "amount"
columns that should be not-null (total spent, total ordered etc).

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Leif B. Kristensen 2005-03-17 14:34:57 Re: update with subselect (long)
Previous Message Stephan Szabo 2005-03-17 14:01:27 Re: update with subselect (long)