When the STATISTICS commands are run separately, less locks will be used than running all three of these updates at once:
UPDATE TABLE STATISTICS AND INDEX STATISTICS AND ALL COLUMN STATISTICS
Run the UPDATE STATISTICS statements in this exact order:update table statistics;
commit;
update index statistics;
commit;
update all column statistics;
commit;The first table and index statistics, will only lock the system statistics tables we write to in this process and do not use many locks.
This formula gives an idea of the number of locks needed and -L can be adjusted accordingly if necessary from the current value of -L:
UPDATE COLUMN STATISTICS uses 11 locks:
- For the 11 records of information we write to the system statistics tables
- 10 values and 1 timestamp for each column of indexed data.
- Example, if a table has 25 columns, and 12 are indexed, this means 12*11=132 locks.