No need to use RUNSTATS when
-
a table is unloaded
-
a table is loaded
-
an index is created
-
a table is reorganized
To answer this question, let's go through each option to understand why it is correct or incorrect:
Option A) A table is unloaded - This option is correct. When a table is unloaded, there is no need to use RUNSTATS. Unloading a table means that the data is being removed from the table, and therefore, there is no data to collect statistics on.
Option B) A table is loaded - This option is incorrect. When a table is loaded, it is recommended to use RUNSTATS to collect statistics on the newly loaded data. This helps the database optimizer make better decisions when generating query plans.
Option C) An index is created - This option is incorrect. When an index is created, it is recommended to use RUNSTATS to collect statistics on the indexed columns. This helps the database optimizer make better decisions when using the index in query plans.
Option D) A table is reorganized - This option is incorrect. When a table is reorganized, it is recommended to use RUNSTATS to collect statistics on the reorganized table. This helps the database optimizer make better decisions when generating query plans for the reorganized table.
The correct answer is A) a table is unloaded. This option is correct because there is no need to use RUNSTATS when a table is unloaded, as there is no data to collect statistics on.
Therefore, the correct answer is option A.
Correct answer: a table is unloaded.
RUNSTATS in DB2 collects statistics (row counts, cardinality, distribution) that the optimizer uses to pick access paths, and it needs to be rerun whenever the physical data or structure changes meaningfully — after loading data, creating an index, or reorganizing a table, since all of these alter row counts, clustering, or index structure.
Unloading a table (extracting its data out, e.g. via UNLOAD utility) does not itself change the table's stored data or structure — the rows remain as they were — so there's nothing new for RUNSTATS to capture. Hence RUNSTATS is unnecessary after an unload, unlike after a load, index creation, or reorg.