Does MySQL use existing indexes when creating new indexes?

I have a large table with millions of records.

Table `price`
------------
id 
product 
site 
value

The table is brand new and there are no indexes.

Then I issued a request to create a new index with the following request:

CREATE INDEX ix_price_site_product_value_id ON price (site, product, value, id);

It took a lot of time, the last time I checked, it worked for 5000+ seconds because of the car.

I am wondering if I am creating another index creation, will it use the existing index in process calculation? If so, in what form?

Then run query 1:

CREATE INDEX ix_price_product_value_id ON price (product, value, id);

Then run query 2:

CREATE INDEX ix_price_value_id ON price (value, id);
+2
source share
2 answers

MySQL 5.1 InnoDB, InnoDB Plugin 1.0, . .

InnoDB:

5.1, MySQL AB "" , MySQL . , MySQL AB, () .

2001 , MySQL AB InnoDB ( , ). MySQL 5.1, InnoDB .

: InnoDB

:

MySQL 5.0 , . CREATE INDEX DROP INDEX , , . , . , , . .

5.1, MySQL . InnoDB MySQL 5.1 . InnoDB , .

...

InnoDB. InnoDB , .

:

+4

, , ? , ?

, .

, (site, product, value, id) ( (product, value, id) (value, id)).

.

-, MySQL ( , ), , . InnoDB, .

-, , .

MySQL , ( B-Tree) . @Daniel, . 5.1 5.5.

+5

Source: https://habr.com/ru/post/1767730/


All Articles