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?
-
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.Nick Coons– Nick Coons2013-08-04 23:43:51 +00:00Commented Aug 4, 2013 at 23:43
-
You should've made that a comment so I can mark it as the answer. :)enchance– enchance2013-08-05 00:05:07 +00:00Commented Aug 5, 2013 at 0:05
Add a comment
|
1 Answer
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`);
2 Comments
enchance
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?hjpotter92
@enchance No. Multiple indexes can exist.