mysqlで特定のカラムにindexをつける
#testというテーブルのidカラムにindexをつける alter table test add index idx(id);
#実行計画をみる explain select id from test where id = 200;
rowsが1になっているので検索時はidが200のものだけを検索している
indexをつけないと948640行の中から探し出している
#testというテーブルのidカラムにindexをつける alter table test add index idx(id);
#実行計画をみる explain select id from test where id = 200;
rowsが1になっているので検索時はidが200のものだけを検索している
indexをつけないと948640行の中から探し出している