A computer program product for archiving data in a relational database management system, a computer comprising at least one processor, one or more memories, one or more computer readable storage media, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by the computer to perform a method comprising:
- creating, by the computer, an invisible index for each primary index of a data table by copying data from the data table of the primary indexes that will not be archived;
- updating, by the computer, both the primary index and invisible indexes based on changes to the data table until an input is received to initiate a block copy of data to be archived;
- receiving, by the computer, an input to initiate block copy of data to be archived;
- locking, by the computer, the data tables;
- block copying, by the computer, identified blocks of data from the data table to an archive table and updating the invisible index to correspond to the data table;
- replacing, by the computer, the primary index with the invisible index;
- unlocking, by the computer, the data tables;
- deleting, by the computer, data blocks from a main table which was copied into the archival table;
- and
- deleting, by the computer, the primary index in which the invisible index was created from prior to archiving.