changed database stats query