mysql索引 - MySQL:索引是否需要整理維護(hù)?
問題描述
每月定期需要對數(shù)據(jù)進(jìn)行大量的刪除操作,想請教這樣操作后對索引是否有影響,是否需要在刪除操作完成后對索引進(jìn)行更新之類的操作
如果需要的話這方面的內(nèi)容搜索哪些關(guān)鍵字呢?
問題解答
回答1:可以使用OPTIMIZE定期優(yōu)化表,每個(gè)星期或者每個(gè)月一次,具體可以參考下面鏈接http://dev.mysql.com/doc/refm...
摘自官網(wǎng)的描述
Use OPTIMIZE TABLE in these cases, depending on the type of table:
After doing substantial insert, update, or delete operations on anInnoDB table that has its own .ibd file because it was created withthe innodb_file_per_table option enabled. The table and indexes arereorganized, and disk space can be reclaimed for use by the operatingsystem.
After doing substantial insert, update, or delete operations oncolumns that are part of a FULLTEXT index in an InnoDB table. Set theconfiguration option innodb_optimize_fulltext_only=1 first. To keepthe index maintenance period to a reasonable time, set theinnodb_ft_num_word_optimize option to specify how many words to updatein the search index, and run a sequence of OPTIMIZE TABLE statementsuntil the search index is fully updated.
After deleting a large part of a MyISAM or ARCHIVE table, or makingmany changes to a MyISAM or ARCHIVE table with variable-length rows(tables that have VARCHAR, VARBINARY, BLOB, or TEXT columns). Deletedrows are maintained in a linked list and subsequent INSERT operationsreuse old row positions. You can use OPTIMIZE TABLE to reclaim theunused space and to defragment the data file. After extensive changesto a table, this statement may also improve performance of statementsthat use the table, sometimes significantly.
相關(guān)文章:
1. python2.7 - python 正則前瞻 后瞻 無法匹配到正確的內(nèi)容2. python - 請問這兩個(gè)地方是為什么呢?3. python - 如何使用websocket在網(wǎng)頁上動態(tài)示實(shí)時(shí)數(shù)據(jù)的折線圖?4. java - Mybatis 數(shù)據(jù)庫多表關(guān)聯(lián)分頁的問題5. mysql如何根據(jù)各自條件批量更新6. 急急急!!!求大神解答網(wǎng)站評論問題,有大神幫幫小弟嗎7. mysql - Sql union 操作8. Python處理Dict生成json9. javascript - 按鈕鏈接到另一個(gè)網(wǎng)址 怎么通過百度統(tǒng)計(jì)計(jì)算按鈕的點(diǎn)擊數(shù)量10. (python)關(guān)于如何做到按win+R再輸入文件文件名就可以運(yùn)行?
