Re: [SQL] Query performance problem

2005-03-18 Thread George Weaver
- From: "Kenneth Gonsalves" <[EMAIL PROTECTED]> To: "Richard Huxton" Cc: <[EMAIL PROTECTED]>; Sent: Thursday, March 17, 2005 11:19 PM Subject: Re: [SQL] Query performance problem On Thursday 17 Mar 2005 7:35 pm, Richard Huxton wrote: Not necessarily. NOT NUL

Re: [SQL] Query performance problem

2005-03-18 Thread Stephan Szabo
On Fri, 18 Mar 2005, Kenneth Gonsalves wrote: > On Thursday 17 Mar 2005 7:35 pm, Richard Huxton wrote: > > > 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 spe

Re: [SQL] Query performance problem

2005-03-18 Thread PFC
DEFAULT applies to INSERTs, NOT NULL applies to UPDATEs too. In MySQL it applies to both (ie. if you UPDATE to an invalid value, it sets it to 'something'). NOT NULL without default is useful when you want to be sure you'll never forget to put a value in that column, when there is no meanin

Re: [SQL] Query performance problem

2005-03-17 Thread Ragnar Hafstaư
On Fri, 2005-03-18 at 10:49 +0530, Kenneth Gonsalves wrote: > On Thursday 17 Mar 2005 7:35 pm, Richard Huxton wrote: > > > 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-n

Re: [SQL] Query performance problem

2005-03-17 Thread Kenneth Gonsalves
On Thursday 17 Mar 2005 7:35 pm, Richard Huxton wrote: > 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). that makes sense - but is it

Re: [SQL] Query performance problem

2005-03-17 Thread Richard Huxton
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)::dou

Re: [SQL] Query performance problem

2005-03-17 Thread PFC
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 Well i

Re: [SQL] Query performance problem

2005-03-17 Thread Kenneth Gonsalves
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 precisi

Re: [SQL] Query performance problem

2005-03-17 Thread PFC
Can anyone tell me why does the following code chokes ... literally - this works almost invisbly under mysql - pg takes more than an hour even on a very small 30 record database. - You should really use 8.0 - How much time toes it takes without the INSERT/UPDATES ? - Please