Redundant Index Report - E4000036 - 22 Nov 2001 (updated 9 Jan 2002)

Large DP4 databases often contain a great many tables and indexes, and it is by no means uncommon for it to become very unclear whether a particular index is required or not. SETLINK has been enhanced to generate a report on "redundant" indexes. The indexes are redundant in the sense that there is another index which will return the same data in the same order, and that therefore one of the indexes can be dispensed with provided any programs that use the index to be turned off are updated as appropriate. A database with redundant indexes is larger and slower than it would be otherwise. The report does not identify indexes that are turned on but which are never actually used, as there is currently no way to determine this. It would be possible to identify which indexes are not used by QAB or Report Writer, but not indexes that are used by C /C++ programs,or SQL.

For example suppose a database has a table containing these tables and fields:

  1. ORDER containing foreign keys ITEM_NR and ORDER_DATE
  2. ITEM with key fields ITEM_NR
  3. INDEX_ITEM_DATE with key fields ITEM_NR and ORDER_DATE

Both the ITEM and INDEX_ITEM_DATE tables index the ORDER table. However there is probably no need to enable both indexes, because the INDEX_ITEM_DATE will return ORDERS in ITIM_NR sequence in any case. Unfortunately the ITEM index IS required if child deletion or orphan checking from ITEM to ORDER is required.

The Redundant Index Report in SETLINK identifies and lists all indexes for which an alternative index can be used instead. The report contains pairs of lines, the first line lists the redundant index, the second an index which can be used as an alternative. (There may be several such indexes, in which case the one with the most keys is listed). The child delete and orphan check settings for the redundant index are also listed. If both of these set are set to NO then the index is definitely redundant. If either is set to Yes the index is not strictly speaking redundant because it is required for these purposes, but you may be able to live without it if you can dispense with these options for this table.

You may occasionally find that the primary index of a table is listed as being redundant. In this case it is more likely that you will wish to switch off the secondary index, as it cannot add any further ordering information to the records in the table. At worst you may need to add a further test to programs that do EQUAL searches on the secondary index. (For example a CREDIT_CARD table might have a primary key of CARD_NR and a secondary index of CARD_NR and STOPPED, so that a program could check it was not stopped with a view to doing a NODATA search on the secondary index. However, in practice it would be better to just inspect the STOPPED field after accessing the record via the primary index.)

Possible Further Developments

09 Jan 2002 Downloads updated to fix bug K4000038

DP4 Version Compatibility

4.523/4.619. For earlier releases use second download and install updated DP4 DLLs

Beta software is supplied without warranty and should not be used in live sites without the agreement of Itim Technology Solutions. Compatibility with an eventual final release cannot be guaranteed.

Downloads

Beta 4.524/4.620 Win32 SETLINK and MAKEDB (requires you to already have 4.523/4.619 installed). Post setlink.m5 or setlink.m6 with MAPPOST as appropriate.
4.619/4.523 database creation/maintenance utilties + 4.524/4.620 SETLINK/MAKEDB. MAPPOST system.m5 or system.m6 as appropriate.