Your Database, Just Faster™ Predict performance bottlenecks and optimize SQL queries, using AI
https://www.eversql.com/
yapp sesuai quotes diatas kita akan mencoba optimize sql query menggunakan eversql, jadi tutorial singkatnya silahkan diikuti:
Quickstart
kita masuk ke web eversql disini .. dan langsung menggunakan quick start button
disana kita akan memilih database dan platform apa yang kita gunakan, silahkan pilih MySQL untuk testing dan langsung masuk ke menu Optimize a single query..
-- Demo query (free to optimize)
SELECT
p.id,
count(DISTINCT c.id)
FROM
posts AS p
LEFT JOIN
comments AS c
ON c.PostId = p.id
WHERE
p.AnswerCount > 3
AND p.title LIKE '%optimized%'
AND DATE(p.CreationDate) >= '2017-01-01'
GROUP BY
p.id
ORDER BY
p.CreationDate LIMIT 100
nanti disana sudah ada sample query dan kita masukkan versinya (versi 8 ya) kemudian optimize.. maka hasilnya akan muncul :
SELECT
p.id,
(SELECT
count(DISTINCT c.id)
FROM
comments AS c
WHERE
c.PostId = p.id LIMIT 1)
FROM
posts AS p
WHERE
p.AnswerCount > 3
AND p.title LIKE '%optimized%'
AND p.CreationDate >= '2017-01-01 00:00:00'
ORDER BY
p.CreationDate LIMIT 100
oke cukup sekian dulu ya.. cyaaa