Re: Large Delete Problem
Posted in 1997
Topics: Connectivity: ODBC / JDBC / .NET
Mohammad Sayeed wrote:
Hi Everyone,
I have a situation where my application is trying to do a
large delete
(actually it's a delete with no where clause) and its hitting a
"long
transaction abort".
System: risk6000 4.1
-------
Informix Online 7.2
Application using ODBC CLI
What we already know:
---------------------
1. Database configauration can be changed to avoid a
long transaction
abort.
2. Since statement in question is deleting everything in
the table we
can drop and create the table.
The problem:
-----------
1. We donot have any control over the database
configuration. I
cannot make any assumtions of a certain log file size or
space either.
2. We would prefer a controlled delete rather than a drop
or create
the table.
Why? Dropping and recreating the table is much faster and doesn't leave
any stray junk laying around.
The question:
------------
Does anyone know of a way doing a delete, say, 2000 rows at
a time?
Mind the fact the table is not ordered in any way.
Are there any date or timestamp columns you could select on?
You could try something like:
delete from table
where table.column matches "A*";
delete from table
where table.column matches "B*";
If you have a column that contains diverse enough data, this would do
the trick.
But I still don't understand the hesitancy to drop and recreate the
table.
Good Luck,
Bret.
Thank you.
Bappy