Table structure is as follows:
Table structure of news:
The CREATE TABLE ` news ` (
` id ` bigint (20) NOT NULL COMMENT 'id',
` number ` bigint (20) NOT NULL COMMENT 'number',
` TMP ` bigint (20) NOT NULL COMMENT 'TMP,
PRIMARY KEY (` id `),
The KEY ` number ` (` number `),
The KEY ` TMP ` (` TMP `)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='test';
Insert into news (id, number, TMP) values (1,2,600);
Insert into news (id, number, TMP) values (6,5,400);
Insert into news (id, number, TMP) values (8,5,300);
Insert into news (id, number, TMP) values (10,5,500);
Insert into news (id, number, TMP) values (13,11,100);
Data A:
B:
Data more than the data A B A record,
Insert into news (id, number, TMP) values (3,4,200);
But when executing the SQL without using the index
Select * from news where number> 2 for update;
Is this why?
CodePudding user response:
A total of 6 records, & gt; Article 2 record up to 4, go index not reinvent the wheel?CodePudding user response:
2 don't walk index, & lt; 2 go index, this point alreadyCodePudding user response:
U013266102Lwjcarrot
Junction post rate: 0%