Search Postgresql Archives

Re: force defaults

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12 September 2012 08:49, Willy-Bas Loos <willybas@xxxxxxxxx> wrote:
Hi,

I want to force deafults, and wonder about the performance.
The trigger i use (below) makes the query (also below) take 45% more time.
The result is the same now, but i do have a use for using the trigger (see "background info").

Isn't there a more efficient way to force the defaults (in the database) when the application layer explicitly inserts a NULL?

Perhaps a rewrite-rule on INSERT/UPDATE would serve your purpose better? You could just wrap the appropriate column with a coalesce-call, like you did in your trigger.

Even then, calling coalesce for each inserted/updated row is not free, of course.

You could also perform the replacing of NULL values in your PHP application. Probably better to handle this case in the database though.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux