Using GROUP BY and ORDER BY, the query takes a long time to execute
If you use GROUP BY and ORDER BY as shown below, the query will take a long time (3000-5000ms), but if you delete either of them again, it will finish in about 40ms. The reason for using GROUP BY is to avoid duplication of data. Using DISTINCT is very time consuming, so we try to use GROUP BY. SELECT “videos_video”.”id” FROM…