Q&A for speakers of other languages learning English
WITH max_comment_dates_no_filter AS ( SELECT postid, MAX(creationdate) AS max_creationdate FROM comments WHERE text IS NOT NULL GROUP BY postid ), latest_comments_no_filter AS ( SELECT c.postid, id, max_creationdate as created_date, c.text AS latest_comment FROM comments c JOIN max_comment_dates_no_filter mcd ON c.postid = mcd.postid AND c.creationdate = mcd.max_creationdate WHERE c.text IS NOT NULL ) select * from latest_comments_no_filter where postid in (52716, 26276819, 3434174, 5571525, 78899597) -- total comments 30396666 -- total comments 30396780 old query -- 52716, 26276819, 3434174, 5571525, 78899597