On Tuesday 11 November 2003 19:46, Josué Maldonado wrote:
> This is the update command:
> update estprod set epr_costo=(select tcos from cost2est2003 where
> code=pro_code and mes=epr_periodo) where epr_periodo >='200301'
>
> The above filters the records to affect only 99157 rows, the update
> takes hours and don't get done (I did cancel it), I changed the filter
> to "epr_periodo ='200301'" to update only 9756 rows but still has more
> than 10 minutes working.
Can you post EXPLAIN ANALYSE <query> on this shorter one - that will show what
PG is doing.
One thing that might be worth looking at is using PG's non-standard
UPDATE t1 SET c1=... FROM t2 ...
--
Richard Huxton
Archonet Ltd