The total number of comments i have is less than 500, but my comment section also shows woocommerce order notes and counting that i have 7500 comments,
But i figured the issue, the comments table had 30000+ action_log rows as well, so i just added action_log to the where clause like this,
SELECT comment_approved, COUNT(*) AS num_comments
FROM wp_comments
WHERE comment_type NOT IN (‘order_note’, ‘webhook_delivery’, ‘action_log’)
GROUP BY comment_approved
and this fixed my issue.