日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

mysql 索引能不能太多,mysql索引太多了?

發布時間:2025/3/17 48 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql 索引能不能太多,mysql索引太多了? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

I am spending some time optimizing our current database.

I am looking at indexes specifically.

There are a few questions:

Is there such a thing as too many indexes?

What will indexes speed up?

What will indexes slow down?

When is it a good idea to add an index?

When is it a bad idea to add an index?

Pro's and Con's of multiple indexes vs multi-column indexes?

解決方案What will indexes speed up?

Data retrieval -- SELECT statements.

What will indexes slow down?

Data manipulation -- INSERT, UPDATE, DELETE statements.

When is it a good idea to add an index?

If you feel you want to get better data retrieval performance.

When is it a bad idea to add an index?

On tables that will see heavy data manipulation -- insertion, updating...

Pro's and Con's of multiple indexes vs multi-column indexes?

Queries need to address the order of columns when dealing with a covering index (an index on more than one column), from left to right in index column definition. The column order in the statement doesn't matter, only that of columns 1, 2 and 3 - a statement needs have a reference to column 1 before the index can be used. If there's only a reference to column 2 or 3, the covering index for 1/2/3 could not be used.

In MySQL, only one index can be used per SELECT/statement in the query (subqueries/etc are seen as a separate statement). And there's a limit to the amount of space per table that MySQL allows. Additionally, running a function on an indexed column renders the index useless - IE:

WHERE DATE(datetime_column) = ...

總結

以上是生活随笔為你收集整理的mysql 索引能不能太多,mysql索引太多了?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。