I am loading a csv file into a mysql database table that uses MyISAM as storage engine. From the process list I can see that this is accomplished in two phases: 1) reading the csv file and 2) repairing the indexes by sorting. FYI, I have kept the indexing to enabled as it was by defult.

Although I am setting myisam_repair_threads to 2 I think mysql is not taking this into count as show processlist shows only one entry in the process list. Also, it takes a little bit of time interval before starting repairing, why?

Please correct my understanding if I am wrong! Why mysql is repairing the tables with only one thread although I have set it to 2? Is there anything I am getting wrong about repairing strategy? TIA!

  • Why REPAIR? Indexes are usually built on the fly. Repairing is only needed after a crash.
    – Rick James
    Commented Oct 14, 2019 at 23:47
  • @RickJames - if you keep motoring the process list (using show processlist) it will show you the query progress in these two phases that i have mentioned above
    – mghh
    Commented Oct 15, 2019 at 4:50
  • Reading the csv -- in app code? using LOAD DATA? loading as ENGINE=CSV?
    – Rick James
    Commented Oct 15, 2019 at 18:28
  • from mysql cli, and yes, using LOAD DATA
    – mghh
    Commented Oct 17, 2019 at 6:03

1 Answer 1


Read carefully:

MySQL 8.0 Reference Manual / ... / Server System Variables

If this value is greater than 1, MyISAM table indexes are created in parallel (each index in its own thread) during the Repair by sorting process.

If your table have 2 indices - then 2 threads will (must) be used.

PS. I'm not sure that you will see this in processlist... this has to be checked.

  • and what about the repairing starting after a bit of pause? any idea?
    – mghh
    Commented Oct 9, 2019 at 4:33
  • @mghh - How many indexes does the table have? Multiple threads are used only if you multiple indexes.
    – Rick James
    Commented Oct 14, 2019 at 23:48
  • And that may apply only to "Repair by sorting" (versus using the key_buffer).
    – Rick James
    Commented Oct 14, 2019 at 23:50
  • @RickJames - the table has 11 indexes, one of which is a composite one
    – mghh
    Commented Oct 15, 2019 at 4:47
  • @Akina is correct about repairing thread count, but i can't find out the reason behind the repairing being initiated after a bit of interval.
    – mghh
    Commented Oct 23, 2019 at 4:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.