CPU savings in IBM Db2. MF Technique 1: Reorg/Discard
The Reorg/Discard utility for IBM Db2 databases deletes records from a table and, at the same time, reorganises the table's data and recovers the fragmented space.
The Reorg/Discard utility is a powerful tool for optimising resources on IBM Db2 mainframe systems, especially in data warehouse environments with large volumes of data. It is key to managing data efficiently and improving system performance in Db2. Below we explain how it works and the many benefits it brings.
What the Reorg/Discard utility does in Db2
Reorganising and discarding at the same time in Db2: The Reorg/Discard utility removes records from a table while it reorganises the remaining data. This optimises disk space in IBM Db2, removing fragmentation and making sure the data is stored contiguously. This is crucial to make data access more efficient and to reduce query response times.
Recovering fragmented space in Db2: When mass deletes are done in IBM Db2, the space the deleted records took up is left empty, causing fragmentation. Reorganising with Reorg/Discard recovers this space, making it available for future inserts and improving the use of storage.
More efficiency in Db2: By sorting the remaining data after the delete, Reorg/Discard makes future access to the table faster. Sorted data makes searching and retrieving information more efficient, reducing processing time and resource consumption.
Benefits of using the Reorg/Discard utility in Db2
Significant CPU savings in IBM Db2: Using Reorg/Discard instead of the conventional DELETE can save a significant amount of CPU. In one case study, CPU consumption fell by more than 60% when Reorg/Discard was used in IBM Db2. This comes from optimising the delete and reorganisation process, which reduces the system's workload.
Space optimisation: Reorg/Discard avoids wasting memory and disk space. By removing records and reorganising the remaining data, it makes sure no unused empty space is left, which is essential in large tables where efficient storage is crucial.
Efficient data access: Keeping data sorted with Reorg/Discard not only improves access time, it also reduces CPU consumption in later read and write operations. This is especially useful in environments that run complex queries and need fast access to large volumes of data.
A real use case
Context: In a table with 944,975,974 records, 635,850,619 records were deleted using Reorg/Discard instead of the standard DELETE. This process not only deleted the records, it also copied the deleted data to a file at the same time, optimising CPU use and significantly improving the performance of the batch process.
Result: The Reorg/Discard utility proved highly efficient in terms of CPU savings and run time. The table was reorganised so that the remaining data was sorted and the recovered space was available for new inserts, improving the overall efficiency of the system.
Recommendations for Db2
Reorg/Discard is ideal for tables with a high volume of records, especially in mass delete operations. Using it in these situations ensures a significant optimisation of system resources.
Avoid it for small deletes: It is not recommended for deleting a few rows, as the reorganisation could consume more CPU and run time than the conventional DELETE.
Final considerations
The Reorg/Discard utility is essential for managing large volumes of data efficiently in Db2 systems. It brings clear benefits in CPU savings, space optimisation and shorter run times. Using it in environments with high data processing demands not only improves system performance, it also ensures the best use of the resources available.
At Orizon, we know how important it is to keep data organised and to optimise space in Db2 tables. With solutions such as Reorg/Discard and analysis tools such as BOA, we can help our clients significantly improve the performance of their mainframe systems, making their operations more efficient and profitable.
For more information about this utility, see the IBM Knowledge Center – Reorg/Discard utility.