database logging speed improvements