database overwrite with autoflush