Adding mysql stored procedures for statistics