Table with 80 million records and adding an index takes more than 18 hours (or forever)! Now what?

前端 未结 5 781
心在旅途
心在旅途 2020-12-07 15:56

A short recap of what happened. I am working with 71 million records (not much compared to billions of records processed by others). On a different thread, someone suggested

5条回答
  •  孤街浪徒
    2020-12-07 16:35

    You are using MyISAM which is being deprecated soon. An alternative would be InnoDB.

    "InnoDB is a transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB row-level locking (without escalation to coarser granularity locks) and Oracle-style consistent nonlocking reads increase multi-user concurrency and performance. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys. To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints. You can freely mix InnoDB tables with tables from other MySQL storage engines, even within the same statement."\

    http://dev.mysql.com/doc/refman/5.0/en/innodb.html

    According to:

    http://dev.mysql.com/tech-resources/articles/storage-engine/part_1.html

    , you should be able to switch between different engine by utilizing a simple alter command which allows you some flexibility. It also states that each table in your DB can be configured independently.

提交回复
热议问题