Dbdelete
Utility: dbdelete.ec
Synopsis: This utility, was written to delete large numbers of rows while
using very few locks and avoiding long transaction problems. The
performance of version 3 is on par with a dbaccess executed DELETE
statement while eliminating the problems with locks and transaction
duration. Versions 1&2 were too slow to be practical and version 1's
source was overly complex, thus was born dbdelete.ec version 3. Note
that in testing no throughput was gained from executing multiple
copies of dbdelete with different WHERE clauses (unlike its
progenitors ul.ec and dbcopy.ec).
Author(s): Art S. Kagel
Revision: 1.22
Features Version: 3.2
Version(s) supported: 7.xx, 8.xx, 9.xx
File(s): dbdelete.ec
Comments: Requires compilation by ESQL/C 7.xx or later.
Release Notes:
Version 1.22 adds a new option, -q, which permits the user to specify a
full SELECT statement to return ROWIDs or keys to select for deletion.
If keys are returned then the -u option is required for -q to work
properly (unexpected results may pursue you if you don't).
Version 1.20 fixes a bug affecting 64bit compiles. Thanks to Raja
Nizad Ks for the feedback that led to this fix and for testing the
patch. Version 1.21 is cosmetic.
Version 1.17 adds the -b CommitSize option and support for FET_BUF_SIZE
environment variable to control transaction size. Version 1.18
increases the Features Versions to 3.2. Version 1.19 fixes a typo.
Version 1.16 removed some dead code and fixed the return type of
usage().
Version 1.14 makes the code safe to use with IDS 9.xx long object
names. Version 1.15 just updates the copyright statement.
Version 1.13 adds a copyright message to the -V printout. Not to
worry, this is just a formality. Use of this utility is still free.
Version 1.12 fixed a missing break statement.
OK, I give up. Version 1.11 replaces itoa() for all systems with
sprintf(). The user support was no longer sensible for the few
cycles I gained on a handful of systems.
Version 1.9 add #if defined()'s to better support compilation on AIX
without GCC. Version 1.10 uses the predefined _AIX rather than the
standard __AIX__.
Version 1.7 extends support for engines that do not support array
fetch code. Now builds the large IN clause anyway. Version 1.8 is
cosmetic only.
Version 1.6 just improves portability. The code uses itoa() to convert
from integer to string, a function which is not universally available.
There is now a #if near the top which uses numtos() on Sun systems
instead and if neither is available defines an inline function using
sprintf which you can enable by defining '-Dnoitoa' at compile time.
Notes:
Delete by ROWID works by fetching a large number of matching rowids
(8191) and using them to build large delete statements with a WHERE
rowid IN (...) clause. The size of each of these delete statements
is controlled and limited by the -B option. If the statement is too
large the time spent by the engine parsing and optimizing the large
statement reduces throughput. On my testbed 2K was the best performer
overall and that is the default, YMMV so this is configurable!