For leveldb "An iterator operates on a snapshot of the database taken when the iterator is created". This means that it is unnecessary to lock out other threads while computing statistics, and neither to hold cs_main for the whole time. Let the thread run free.
I've been using this patch for about 8 months without issues, including on a node that automatically dumps the information for every N blocks.