moved statistics sql statements to statistics plugin (#121)