Added functions for statistics of database