Why add an order by ID to scan less.
This is the structure
CREATE TABLE phone_copy (
idInt (1) not NULL auto_increment,
phonevarchar (+) CHARACTER SET UTF8 DEFAULT NULL,
typevarchar (255) CHARACTER SET UTF8 DEFAULT NULL,
PRIMARY KEY ( id ),
UNIQUE KEY phone ( phone )
) Engine=innodb auto_increment=228483 DEFAULT charset=latin1;
This is a query statement (only if you add an order by ID to sweep less, plus where the ID is greater than how much is not so, why is the limit or continue scanning it)
EXPLAIN SELECT * from phone_copy ORDER by ID limit 1
This is the result;
Reply content:
Why add an order by ID to scan less.
This is the structure
CREATE TABLE phone_copy (
idInt (1) not NULL auto_increment,
phonevarchar (+) CHARACTER SET UTF8 DEFAULT NULL,
typevarchar (255) CHARACTER SET UTF8 DEFAULT NULL,
PRIMARY KEY ( id ),
UNIQUE KEY phone ( phone )
) Engine=innodb auto_increment=228483 DEFAULT charset=latin1;
This is a query statement (only if you add an order by ID to sweep less, plus where the ID is greater than how much is not so, why is the limit or continue scanning it)
EXPLAIN SELECT * from phone_copy ORDER by ID limit 1
This is the result;
An order by limit is used, if the order by field is an indexed field, the limit is directly on the index