[DB] Use a completion flag to improve performance.