[Groonga-mysql-commit] mroonga/mroonga.github.com at 5c56680 [master] Update procedure to recreate table

Back to archive index
Kentaro Hayashi null+****@clear*****
Wed Jul 31 14:29:12 JST 2019


Kentaro Hayashi	2019-07-31 14:29:12 +0900 (Wed, 31 Jul 2019)

  Revision: 5c566809c5de128deed0f74cfcd805efdbc81017
  https://github.com/mroonga/mroonga.github.com/commit/5c566809c5de128deed0f74cfcd805efdbc81017

  Message:
    Update procedure to recreate table

  Modified files:
    en/_posts/2019-07-30-mroonga-9.05.md
    ja/_posts/2019-07-30-mroonga-9.05.md

  Modified: en/_posts/2019-07-30-mroonga-9.05.md (+7 -1)
===================================================================
--- en/_posts/2019-07-30-mroonga-9.05.md    2019-07-31 13:41:31 +0900 (2332d9d)
+++ en/_posts/2019-07-30-mroonga-9.05.md    2019-07-31 14:29:12 +0900 (4fa2709)
@@ -71,7 +71,13 @@ ERROR 1062 (23000): Duplicate entry '10-100' for key 'source_id'
 In above example, old index entry was not deleted correctly, therefore duplicated key error was occurred.
 
 In this case, you must recreate an target table because unique index may have garbage entries.
-We recommend to recreate an target table with dump and restore, or execute `ALTER TABLE (TABLE_NAME) FORCE`.
+We recommend to recreate an target table with dump and restore, or execute the following queries.
+
+```sql
+ALTER TABLE (TABLE_NAME) DISABLE KEYS;
+ALTER TABLE (TABLE_NAME) FORCE;
+ALTER TABLE (TABLE_NAME) ENABLE KEYS;
+```
 
 ### Conclusion
 

  Modified: ja/_posts/2019-07-30-mroonga-9.05.md (+7 -1)
===================================================================
--- ja/_posts/2019-07-30-mroonga-9.05.md    2019-07-31 13:41:31 +0900 (83027a9)
+++ ja/_posts/2019-07-30-mroonga-9.05.md    2019-07-31 14:29:12 +0900 (2e25084)
@@ -73,7 +73,13 @@ ERROR 1062 (23000): Duplicate entry '10-100' for key 'source_id'
 上記のようなケースで、古いインデックスのエントリが削除されず、キーの重複が発生してしまっていました。
 
 冒頭でも述べましたが、すでにユニークインデックスを作っている人はテーブルを作り直す必要があります。
-テーブルを作り直すには、ダンプ・リストアするか、`ALTER TABLE (ユニークインデックスを作ったテーブル} FORCE` を実行してください。
+テーブルを作り直すには、ダンプ・リストアするか、以下の手順を実行してください。
+
+```sql
+ALTER TABLE (ユニークインデックスを作ったテーブル) DISABLE KEYS;
+ALTER TABLE (ユニークインデックスを作ったテーブル) FORCE;
+ALTER TABLE (ユニークインデックスを作ったテーブル) ENABLE KEYS;
+```
 
 ### おわりに
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.osdn.me/mailman/archives/groonga-mysql-commit/attachments/20190731/7edc3a75/attachment-0001.html>


More information about the Groonga-mysql-commit mailing list
Back to archive index