I dump database and i have one question. What does this query?
ALTER TABLE `ps_cart_rule` ADD KEY `id_customer` (`id_customer`,`active`,`date_to`); ALTER TABLE `ps_cart_rule` ADD KEY `id_customer_2` (`id_customer`,`active`,`highlight`,`date_to`);
What is diffrence between ADD KEY and ADD INDEX?
There's no difference. They are synonyms. From the CREATE TABLE manual entry: KEY is normally a synonym for INDEX .
As per MySql documentation, KEY is normally a synonym for INDEX. The key attribute PRIMARY KEY can also be specified as just KEY when given in a column definition. This was implemented for compatibility with other database systems. In your case ADD KEY will explicitly define index on that field.
MySQL has three types of indexes: INDEX, UNIQUE (which requires each row to have a unique value), and PRIMARY KEY (which is just a particular UNIQUE index).
A composite key in MySQL is a combination of two or more than two columns in a table that allows us to identify each row of the table uniquely. It is a type of candidate key which is formed by more than one column.
KEY
is a synonym for INDEX
.
... | ADD {INDEX|KEY} [index_name] ...
Check the MySQL documentation for ALTER TABLE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With