使我的概念更加清晰,關於Mysql
中的索引。我知道的是索引是用來使你的查詢更快。除了我有幾個問題需要了解。如何在mysql中使用索引以及使用哪些參數
比方說,我有一個查詢:
SELECT books.name, books.name2, books.id, books.image, books.faith, books.topic, books.downloaded, books.viewed, books.language, books.size, books.author as author_id, authors.name as author_name, authors.aid from books LEFT JOIN authors ON books.author = authors.aid WHERE books.id = '".$id."' AND status = 1
- 是任何指標適用於本
select
查詢,同時它具有JOIN
? - 在對列查詢進行索引後,會優化 或更改?
- 如何爲此查詢製作索引並針對哪一列?
- 使用索引的其他好處或缺點是什麼?
- 在哪些情況下應該避免索引,哪些應該使用索引 更多?
- 索引是否適用於隨機查詢?
- 索引在
IDS
上效率更高嗎?
請通知,謝謝您的提前!
請通過[link1](http://stackoverflow.com/questions/3049283/mysql-indexes-what-are-the-best-practices),[link2](http://stackoverflow.com/questions/3567981/how-do-mysql-indexes-work) –
[Cookbook on building an index](http://mysql.rjweb.org/doc.php/index_cookbook_mysql)。 –