On Wed, 30 Jan 2002, Andrew Sullivan wrote:
> On Wed, Jan 30, 2002 at 11:07:43AM -0500, Francisco Reyes wrote:
>
> > Nightly doing delete of about 6 million records and then re-merging.
> > Previously I was doing truncate, but this was an issue if a user tried to
> > use the system while we were loading. Now we are having a problem while
> > the server is running vacuum analyzes.
>
> I'm not sure I understand the problem of "issue if a user tried to
> use the system while we were loading". I understand that, of course,
> the data is gone when you truncate; but won't it be anyway, if you
> delete?
You can put the delete/load inside a transaction so the users will never
see an empty table. Truncate can not be placed inside a transaction.
We basically do
begin transaction
delete
copy
commit transaction