Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com> writes:
> 2005/8/29, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> >
> > What is the function doing to the table, exactly? DDL changes generally
> > take exclusive locks ...
>
> This is the transaction:
>
> begin;
> select update_last_date();
> truncate times_producao;
I think truncate takes a table lock.
Just change it to "delete from times_producao".
Also, if consider doing a "vacuum full" or "cluster" after the batch job to
clear up the free space (not in a large transaction). That will still take a
table lock but it may be a small enough downtime to be worth the speed
increase the rest of the day.
--
greg