MySQL 的 SQL Query...

Percona 的 blog 上跑出一篇「What kind of queries are bad for MySQL?」,分析哪些 SQL query 對 MySQL 的效能不好...

內容相當偏激,然後在 comment 引起討論... (文章作者反而就跑去休息了)

舉例來說,他認為只要有 JOIN 就算是 bad query。作者舉了這樣的 SQL query 為例:

SELECT t2.value FROM t2 JOIN t1 ON (t1.id=t2.tid) WHERE t1.orderdate=NOW()

應該要被展開成:

SELECT t2.value FROM t2 WHERE t2.orderdate=NOW()

看得出來有重度 denormalize 與 cache 症狀... XD

This entry was posted in Computer, Database, Murmuring, MySQL, Network, Software and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *