| From: | Greg Stark <gsstark(at)mit(dot)edu> |
|---|---|
| To: | Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-general postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: update functions locking tables |
| Date: | 2005-08-30 13:10:51 |
| Message-ID: | 87fysr4lk4.fsf@stark.xeocode.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Stark | 2005-08-30 13:12:18 | Re: psql from Linux script |
| Previous Message | Devrim GUNDUZ | 2005-08-30 13:10:36 | 8.1beta1 RPMs |