Try to minimize the use of DISTINCT within GROUP_CONCAT. You can achieve this by grouping your posts more efficiently. Use with() to eagerly load instead of manual connections. This reduces the number of queries and speeds up the process.