X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CC869566EC for ; Fri, 18 Mar 2005 07:33:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38123-04 for ; Fri, 18 Mar 2005 07:33:32 +0000 (GMT) Received: from quasar.skima.is (quasar.skima.is [212.30.200.205]) by svr1.postgresql.org (Postfix) with ESMTP id 1EA98566DF for ; Fri, 18 Mar 2005 07:33:31 +0000 (GMT) Received: from gnari ([157.157.159.208] [157.157.159.208]) by quasar.skima.is with ESMTP; Fri, 18 Mar 2005 07:32:10 Z Subject: Re: Query performance problem From: Ragnar =?ISO-8859-1?Q?Hafsta=F0?= To: Kenneth Gonsalves Cc: Richard Huxton , weberp@paradise.net.nz, pgsql-sql@postgresql.org In-Reply-To: <200503181049.47566.lawgon@thenilgiris.com> References: <200503172120.20676.weberp@paradise.net.nz> <200503171801.19412.lawgon@thenilgiris.com> <42398EB9.2050707@archonet.com> <200503181049.47566.lawgon@thenilgiris.com> Content-Type: text/plain Date: Fri, 18 Mar 2005 07:32:52 +0000 Message-Id: <1111131172.25405.17.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200503/256 X-Sequence-Number: 20735 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-null (total spent, total > > ordered etc). > > that makes sense - but is it necessary to have a not null constraint > when there is a default value? DEFAULT applies to INSERTs, NOT NULL applies to UPDATEs too. gnari