reduced database queries during logging