0

I tried to index a date time field in a table with 20 million rows. Majority(99%) of the rows for that column are null. After that, CPU utilization shot up to 100% because of this. I'm not able to find out the exact reason for the same.

1

1 Answer 1

0

As an optimization, InnoDB "delays" the updating of indexes. Probably what happened is that this delayed operation is happening, causing the CPU to spike.

For further info, search for "InnoDB change buffering".

Sign up to request clarification or add additional context in comments.

4 Comments

I deleted the indexes once CPU spiked up. I need to be sure of the root cause before I create the indexes again. Any pointers for debugging? Any estimate for it's delayed index update to complete?
20M rows -- They have to be scanned, a file created and sorted, then written back to disk, etc. Please show us the command you used and the SHOW CREATE TABLE.
Minutes / hours. Depends on lots of things -- size of table, setting of innodb_buffer_pool_size, spinning drives vs SSDs, etc
Algo used: CREATE INDEX name-index on table-name(column-name) algorithm=inplace

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.