1

My _sitecustomers table has around 67,000 records and after optimizing the site's search I decided I should have indexed 1 or 2 more columns to speed up the query. Is there a way to index an already active table with this many records?

2
  • Yes, you can add the index to a table in use just as you would if the table was not in use. With 87,000 rows, it may take a little time depending on what is contained within the column you're indexing. Commented Aug 4, 2013 at 23:43
  • You should've made that a comment so I can mark it as the answer. :) Commented Aug 5, 2013 at 0:05

1 Answer 1

3

67k is not a real big number of records. A simple ALTER TABLE statement will work:

ALTER TABLE `_sitecustomers`
    ADD INDEX `col1` (`col1`),
    ADD INDEX `col2` (`col2`);
Sign up to request clarification or add additional context in comments.

2 Comments

Correct me if this is wrong: ALTER TABLE _sitecustomers ADD INDEX somename (col1 ASC, col2 ASC). I'm trying to use 2 columns to make an index. Currently, one of my columns (e.g. col1) already has an index. Do I have to delete that first?
@enchance No. Multiple indexes can exist.

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.