Performance: reduce amount of statement preparation, increase prepared statement reuse

I can eventually add a comment.