Re: How do "locks" work when doing deletes?
Posted in 1996
Topics: Storage & Space Management, Transactions, Locking & Isolation
> <D4kLaho@PacBell.COM> writes
> >Hi all,
> >
> >Looking for a few simple answer here (at least I believe they are).
> >
> >If I have a table having say a million rows called "ttable", and 2
> >users simultaneousIy execute a "delete from ttable;" command, will
> >there be any table locks involved. . .
> >
> >a) . . .if the database has logging?
> >
> >b) . . .if the database does not have logging?
> >
> >c) . . .or how about if I have only 1 user performing the command?
> > Would that make a difference with respect to a) & b)?
> >
> >TIA
>>>>
Depending on your configuration, this could cause you
two potential problems (as you are probably already aware):
1) lock table overflow
2) long transaction
Even with just 1 user.
With logging off, and LOCK TABLE IN EXCLUSIVE MODE,
you avoid both 1) and 2) AND you prevent the 2 users from
getting in each other's way.
If you truly want to delete all rows from that large a table,
I would just drop and recreate it.... it's MUCH MUCH faster
that way. No lock problems, no transaction problems,
no 2-user problems.
You just need to make sure you put in the dbspace and
extent sizes. (I wish Informix would do this for us in dbschema!)