How to execute a systematic SQL rebuild of indexes