[WIP]database flushing