How do I add indices to MySQL tables?

后端 未结 7 1839
北荒
北荒 2020-11-22 13:54

I\'ve got a very large MySQL table with about 150,000 rows of data. Currently, when I try and run

SELECT * FROM table WHERE id = \'1\';

the

7条回答
  •  无人及你
    2020-11-22 14:29

    ALTER TABLE `table` ADD INDEX `product_id_index` (`product_id`)
    

    Never compare integer to strings in MySQL. If id is int, remove the quotes.

提交回复
热议问题