關於此帖子的第一個答案:Update one MySQL table with values from another 它聲明爲了加快查詢速度,必須創建一個索引。我該怎麼做呢?索引sql列加快加入查詢
我知道這是相當簡單的我只是無法弄清楚如何..
關於此帖子的第一個答案:Update one MySQL table with values from another 它聲明爲了加快查詢速度,必須創建一個索引。我該怎麼做呢?索引sql列加快加入查詢
我知道這是相當簡單的我只是無法弄清楚如何..
ALTER TABLE `your_table` ADD INDEX `your_index_name`
(`column_that_should_be_indexed`)
的general syntax用於創建指標如下 -
CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name
[index_type]
ON tbl_name (index_col_name,...)
[index_type]
index_col_name:
col_name [(length)] [ASC | DESC]
index_type:
USING {BTREE | HASH}
典型的語法是:
create index <index name> on <tablename>(<one or more columns>);
例如:
create index t_col1_col2 on t(col1, col2);
請注意,當您將列聲明爲主鍵或唯一(或添加唯一約束)時,您還可以創建索引。
此外,索引有時最有效,當它們是複合 - 也就是說,它們包含多個列。