Re: [GENERAL] Denormalized field

2013-08-19 Thread BladeOfLight16
On Mon, Aug 19, 2013 at 4:27 AM, Vik Fearing wrote: > Yes, I would use a trigger for this. > > > This is definitely the right answer, but keep in mind that this will slow down your inserts since it calls slow_function for each insert. Make sure you can afford that performance hit.

Re: [GENERAL] Denormalized field

2013-08-19 Thread Luca Ferrari
On Sun, Aug 18, 2013 at 5:56 AM, Robert James wrote: > What's the best way to do this automatically? Can this be done with > triggers? (On UPDATE or INSERT, SET slow_function_f = > slow_function(new_f) ) How? > Define a before trigger that updates your column. For instance: CREATE OR REPLACE FU

Re: [GENERAL] Denormalized field

2013-08-19 Thread Vik Fearing
On 08/18/2013 05:56 AM, Robert James wrote: > I have a slow_function. My table has field f, and since slow_function > is slow, I need to denormalize and store slow_function(f) as a field. > > What's the best way to do this automatically? Can this be done with > triggers? (On UPDATE or INSERT, SET