Re: Query performance problem
От | Stephan Szabo |
---|---|
Тема | Re: Query performance problem |
Дата | |
Msg-id | 20050318051614.Q61964@megazone.bigpanda.com обсуждение исходный текст |
Ответ на | Re: Query performance problem (Kenneth Gonsalves <lawgon@thenilgiris.com>) |
Список | pgsql-sql |
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 spent, total > > ordered etc). > > that makes sense - but is it necessary to have a not null constraint > when there is a default value? It's also an added check which prevents you from explicitly setting the value to NULL in an insert or update, since "insert into foo(col1) values (NULL);" shouldn't insert the default value into col1. This is relatively minor generally, but if you have queries whose behavior is broken by NULLs (things using IN/NOT IN for example) it's better to be safe.
В списке pgsql-sql по дате отправления: