Re: [PERFORM] Trigger function, bad performance

2008-12-05 Thread Rogatzki Rainer
Laurenz Albe wrote: > You have been ordered to use a partial index? > > > Apart from this I don't really understand why statement preparation > > combined with parameters in functions prevent index invocation. > > Especially since p_id_user is a parameter as well which doesn't > > prevent the us

Re: [PERFORM] Trigger function, bad performance

2008-12-05 Thread Rogatzki Rainer
> > Rogatzki wrote: > > -- Example with bad performance since index isn't used > > explain > > select c.id_country, sum(c.cost) as sum_cost > > from costs c, accounting_interval a > > where c.id_user = 123 > > and c.id_state = 1 > > and a.id = 1 > > and date(c.request) between a.p_

Re: [PERFORM] Trigger function, bad performance

2008-12-05 Thread Rogatzki Rainer
> Rogatzki Rainer wrote: > > I'm having problems with the following bad performing select-statement > > in a trigger-function (on update before): > > > > ... > > for c in > > select id_country, sum(cost) as sum_cost > > from c

[PERFORM] Trigger function, bad performance

2008-12-04 Thread Rogatzki Rainer
Hello, I'm having problems with the following bad performing select-statement in a trigger-function (on update before): ... for c in select id_country, sum(cost) as sum_cost from costs where id_user = p_id_user and id_state = 1 and date(request) between p_begin and p_until