In case you have your own slow SQL query, you can optimize it automatically here.
For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:
ALTER TABLE `conversations` ADD INDEX `conversations_idx_id` (`id`);
ALTER TABLE `messages` ADD INDEX `messages_idx_cid` (`cid`);
SELECT
conversations.id,
max(messages.timestamp) AS latest_message
FROM
conversations
JOIN
messages
ON conversations.id = messages.cid
GROUP BY
conversations.id
ORDER BY
latest_message