sql MySQL的查询优化的一个例子

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql MySQL的查询优化的一个例子相关的知识,希望对你有一定的参考价值。

-- 导入的数据

use test;
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');
insert into service(value) values('xff');

insert into history(ser_id, his_status) values (1, 2);
insert into history(ser_id, his_status) values (2, 2);
insert into history(ser_id, his_status) values (3, 2);
insert into history(ser_id, his_status) values (4, 2);
insert into history(ser_id, his_status) values (5, 2);
insert into history(ser_id, his_status) values (6, 2);
insert into history(ser_id, his_status) values (7, 2);
insert into history(ser_id, his_status) values (8, 2);
insert into history(ser_id, his_status) values (9, 2);
insert into history(ser_id, his_status) values (10, 2);
insert into history(ser_id, his_status) values (11, 2);
insert into history(ser_id, his_status) values (12, 2);
insert into history(ser_id, his_status) values (13, 2);
insert into history(ser_id, his_status) values (14, 2);
insert into history(ser_id, his_status) values (15, 2);
insert into history(ser_id, his_status) values (16, 2);
insert into history(ser_id, his_status) values (17, 2);
insert into history(ser_id, his_status) values (18, 2);
insert into history(ser_id, his_status) values (19, 2);
insert into history(ser_id, his_status) values (20, 2);
insert into history(ser_id, his_status) values (21, 2);
insert into history(ser_id, his_status) values (22, 2);
insert into history(ser_id, his_status) values (23, 2);
insert into history(ser_id, his_status) values (24, 2);
insert into history(ser_id, his_status) values (25, 2);
insert into history(ser_id, his_status) values (26, 2);
insert into history(ser_id, his_status) values (27, 2);
insert into history(ser_id, his_status) values (28, 2);
insert into history(ser_id, his_status) values (29, 2);
insert into history(ser_id, his_status) values (30, 2);
insert into history(ser_id, his_status) values (31, 2);
insert into history(ser_id, his_status) values (32, 2);
insert into history(ser_id, his_status) values (33, 2);
insert into history(ser_id, his_status) values (34, 2);
insert into history(ser_id, his_status) values (35, 2);
insert into history(ser_id, his_status) values (36, 2);
insert into history(ser_id, his_status) values (37, 2);
insert into history(ser_id, his_status) values (38, 2);
insert into history(ser_id, his_status) values (39, 2);
insert into history(ser_id, his_status) values (40, 2);
insert into history(ser_id, his_status) values (41, 2);
insert into history(ser_id, his_status) values (42, 2);
insert into history(ser_id, his_status) values (43, 2);
insert into history(ser_id, his_status) values (44, 2);
insert into history(ser_id, his_status) values (45, 2);
insert into history(ser_id, his_status) values (46, 2);
insert into history(ser_id, his_status) values (47, 2);
insert into history(ser_id, his_status) values (48, 2);
insert into history(ser_id, his_status) values (49, 2);
insert into history(ser_id, his_status) values (50, 2);
insert into history(ser_id, his_status) values (51, 2);
insert into history(ser_id, his_status) values (52, 2);
insert into history(ser_id, his_status) values (53, 2);
insert into history(ser_id, his_status) values (54, 2);
insert into history(ser_id, his_status) values (55, 2);
insert into history(ser_id, his_status) values (56, 2);
insert into history(ser_id, his_status) values (57, 2);
insert into history(ser_id, his_status) values (58, 2);
insert into history(ser_id, his_status) values (59, 2);
insert into history(ser_id, his_status) values (60, 2);
insert into history(ser_id, his_status) values (61, 2);
insert into history(ser_id, his_status) values (62, 2);
insert into history(ser_id, his_status) values (63, 2);
insert into history(ser_id, his_status) values (64, 2);
insert into history(ser_id, his_status) values (65, 2);
insert into history(ser_id, his_status) values (66, 2);
insert into history(ser_id, his_status) values (67, 2);
insert into history(ser_id, his_status) values (68, 2);
insert into history(ser_id, his_status) values (69, 2);
insert into history(ser_id, his_status) values (70, 2);
insert into history(ser_id, his_status) values (71, 2);
insert into history(ser_id, his_status) values (72, 2);
insert into history(ser_id, his_status) values (73, 2);
insert into history(ser_id, his_status) values (74, 2);
insert into history(ser_id, his_status) values (75, 2);
insert into history(ser_id, his_status) values (76, 2);
insert into history(ser_id, his_status) values (77, 2);
insert into history(ser_id, his_status) values (78, 2);
insert into history(ser_id, his_status) values (79, 2);
insert into history(ser_id, his_status) values (80, 2);
insert into history(ser_id, his_status) values (81, 2);
insert into history(ser_id, his_status) values (82, 2);
insert into history(ser_id, his_status) values (83, 2);
insert into history(ser_id, his_status) values (84, 2);
insert into history(ser_id, his_status) values (85, 2);
insert into history(ser_id, his_status) values (86, 2);
insert into history(ser_id, his_status) values (87, 2);
insert into history(ser_id, his_status) values (88, 2);
insert into history(ser_id, his_status) values (89, 2);
insert into history(ser_id, his_status) values (90, 2);
insert into history(ser_id, his_status) values (91, 2);
insert into history(ser_id, his_status) values (92, 2);
insert into history(ser_id, his_status) values (93, 2);
insert into history(ser_id, his_status) values (94, 2);
insert into history(ser_id, his_status) values (95, 2);
insert into history(ser_id, his_status) values (96, 2);
insert into history(ser_id, his_status) values (97, 2);
insert into history(ser_id, his_status) values (98, 2);
insert into history(ser_id, his_status) values (99, 2);
insert into history(ser_id, his_status) values (100, 2);
insert into history(ser_id, his_status) values (101, 2);
insert into history(ser_id, his_status) values (102, 2);
insert into history(ser_id, his_status) values (103, 2);
insert into history(ser_id, his_status) values (104, 2);
insert into history(ser_id, his_status) values (105, 2);
insert into history(ser_id, his_status) values (106, 2);
insert into history(ser_id, his_status) values (107, 2);
insert into history(ser_id, his_status) values (108, 2);
insert into history(ser_id, his_status) values (109, 2);
insert into history(ser_id, his_status) values (110, 2);
insert into history(ser_id, his_status) values (111, 2);
insert into history(ser_id, his_status) values (112, 2);
insert into history(ser_id, his_status) values (113, 2);
insert into history(ser_id, his_status) values (114, 2);
insert into history(ser_id, his_status) values (115, 2);
insert into history(ser_id, his_status) values (116, 2);
insert into history(ser_id, his_status) values (117, 2);
insert into history(ser_id, his_status) values (118, 2);
insert into history(ser_id, his_status) values (119, 2);
insert into history(ser_id, his_status) values (120, 2);
insert into history(ser_id, his_status) values (121, 2);
insert into history(ser_id, his_status) values (122, 2);
insert into history(ser_id, his_status) values (123, 2);
insert into history(ser_id, his_status) values (124, 2);
insert into history(ser_id, his_status) values (125, 2);
insert into history(ser_id, his_status) values (126, 2);
insert into history(ser_id, his_status) values (127, 2);
insert into history(ser_id, his_status) values (128, 2);
insert into history(ser_id, his_status) values (129, 2);
insert into history(ser_id, his_status) values (130, 2);
insert into history(ser_id, his_status) values (131, 2);
insert into history(ser_id, his_status) values (132, 2);
insert into history(ser_id, his_status) values (133, 2);
insert into history(ser_id, his_status) values (134, 2);
insert into history(ser_id, his_status) values (135, 2);
insert into history(ser_id, his_status) values (136, 2);
insert into history(ser_id, his_status) values (137, 2);
insert into history(ser_id, his_status) values (138, 2);
insert into history(ser_id, his_status) values (139, 2);
insert into history(ser_id, his_status) values (140, 2);
insert into history(ser_id, his_status) values (141, 2);
insert into history(ser_id, his_status) values (142, 2);
insert into history(ser_id, his_status) values (143, 2);
insert into history(ser_id, his_status) values (144, 2);
insert into history(ser_id, his_status) values (145, 2);
insert into history(ser_id, his_status) values (146, 2);
insert into history(ser_id, his_status) values (147, 2);
insert into history(ser_id, his_status) values (148, 2);
insert into history(ser_id, his_status) values (149, 2);
insert into history(ser_id, his_status) values (150, 2);
insert into history(ser_id, his_status) values (151, 2);
insert into history(ser_id, his_status) values (152, 2);
insert into history(ser_id, his_status) values (153, 2);
insert into history(ser_id, his_status) values (154, 2);
insert into history(ser_id, his_status) values (155, 2);
insert into history(ser_id, his_status) values (156, 2);
insert into history(ser_id, his_status) values (157, 2);
insert into history(ser_id, his_status) values (158, 2);
insert into history(ser_id, his_status) values (159, 2);
insert into history(ser_id, his_status) values (160, 2);
insert into history(ser_id, his_status) values (161, 2);
insert into history(ser_id, his_status) values (162, 2);
insert into history(ser_id, his_status) values (163, 2);
insert into history(ser_id, his_status) values (164, 2);
insert into history(ser_id, his_status) values (165, 2);
insert into history(ser_id, his_status) values (166, 2);
insert into history(ser_id, his_status) values (167, 2);
insert into history(ser_id, his_status) values (168, 2);
insert into history(ser_id, his_status) values (169, 2);
insert into history(ser_id, his_status) values (170, 2);
insert into history(ser_id, his_status) values (171, 2);
insert into history(ser_id, his_status) values (172, 2);
insert into history(ser_id, his_status) values (173, 2);
insert into history(ser_id, his_status) values (174, 2);
insert into history(ser_id, his_status) values (175, 2);
insert into history(ser_id, his_status) values (176, 2);
insert into history(ser_id, his_status) values (177, 2);
insert into history(ser_id, his_status) values (178, 2);
insert into history(ser_id, his_status) values (179, 2);
insert into history(ser_id, his_status) values (180, 2);
insert into history(ser_id, his_status) values (181, 2);
insert into history(ser_id, his_status) values (182, 2);
insert into history(ser_id, his_status) values (183, 2);
insert into history(ser_id, his_status) values (184, 2);
insert into history(ser_id, his_status) values (185, 2);
insert into history(ser_id, his_status) values (186, 2);
insert into history(ser_id, his_status) values (187, 2);
insert into history(ser_id, his_status) values (188, 2);
insert into history(ser_id, his_status) values (189, 2);
insert into history(ser_id, his_status) values (190, 2);
insert into history(ser_id, his_status) values (191, 2);
insert into history(ser_id, his_status) values (192, 2);
insert into history(ser_id, his_status) values (193, 2);
insert into history(ser_id, his_status) values (194, 2);
insert into history(ser_id, his_status) values (195, 2);
insert into history(ser_id, his_status) values (196, 2);
insert into history(ser_id, his_status) values (197, 2);
insert into history(ser_id, his_status) values (198, 2);
insert into history(ser_id, his_status) values (199, 2);
insert into history(ser_id, his_status) values (200, 2);
insert into history(ser_id, his_status) values (201, 2);
insert into history(ser_id, his_status) values (202, 2);
insert into history(ser_id, his_status) values (203, 2);
insert into history(ser_id, his_status) values (204, 2);
insert into history(ser_id, his_status) values (205, 2);
insert into history(ser_id, his_status) values (206, 2);
insert into history(ser_id, his_status) values (207, 2);
insert into history(ser_id, his_status) values (208, 2);
insert into history(ser_id, his_status) values (209, 2);
insert into history(ser_id, his_status) values (210, 2);
insert into history(ser_id, his_status) values (211, 2);
insert into history(ser_id, his_status) values (212, 2);
insert into history(ser_id, his_status) values (213, 2);
insert into history(ser_id, his_status) values (214, 2);
insert into history(ser_id, his_status) values (215, 2);
insert into history(ser_id, his_status) values (216, 2);
insert into history(ser_id, his_status) values (217, 2);
insert into history(ser_id, his_status) values (218, 2);
insert into history(ser_id, his_status) values (219, 2);
insert into history(ser_id, his_status) values (220, 2);
insert into history(ser_id, his_status) values (221, 2);
insert into history(ser_id, his_status) values (222, 2);
insert into history(ser_id, his_status) values (223, 2);
insert into history(ser_id, his_status) values (224, 2);
insert into history(ser_id, his_status) values (225, 2);
insert into history(ser_id, his_status) values (226, 2);
insert into history(ser_id, his_status) values (227, 2);
insert into history(ser_id, his_status) values (228, 2);
insert into history(ser_id, his_status) values (229, 2);
insert into history(ser_id, his_status) values (230, 2);
insert into history(ser_id, his_status) values (231, 2);
insert into history(ser_id, his_status) values (232, 2);
insert into history(ser_id, his_status) values (233, 2);
insert into history(ser_id, his_status) values (234, 2);
insert into history(ser_id, his_status) values (235, 2);
insert into history(ser_id, his_status) values (236, 2);
insert into history(ser_id, his_status) values (237, 2);
insert into history(ser_id, his_status) values (238, 2);
insert into history(ser_id, his_status) values (239, 2);
insert into history(ser_id, his_status) values (240, 2);
insert into history(ser_id, his_status) values (241, 2);
insert into history(ser_id, his_status) values (242, 2);
insert into history(ser_id, his_status) values (243, 2);
insert into history(ser_id, his_status) values (244, 2);
insert into history(ser_id, his_status) values (245, 2);
insert into history(ser_id, his_status) values (246, 2);
insert into history(ser_id, his_status) values (247, 2);
insert into history(ser_id, his_status) values (248, 2);
insert into history(ser_id, his_status) values (249, 2);
insert into history(ser_id, his_status) values (250, 2);
insert into history(ser_id, his_status) values (251, 1);
insert into history(ser_id, his_status) values (252, 1);
insert into history(ser_id, his_status) values (253, 1);
insert into history(ser_id, his_status) values (254, 1);
insert into history(ser_id, his_status) values (255, 1);
insert into history(ser_id, his_status) values (256, 1);
insert into history(ser_id, his_status) values (257, 1);
insert into history(ser_id, his_status) values (258, 1);
insert into history(ser_id, his_status) values (259, 1);
insert into history(ser_id, his_status) values (260, 1);
insert into history(ser_id, his_status) values (261, 1);
insert into history(ser_id, his_status) values (262, 1);
insert into history(ser_id, his_status) values (263, 1);
insert into history(ser_id, his_status) values (264, 1);
insert into history(ser_id, his_status) values (265, 1);
insert into history(ser_id, his_status) values (266, 1);
insert into history(ser_id, his_status) values (267, 1);
insert into history(ser_id, his_status) values (268, 1);
insert into history(ser_id, his_status) values (269, 1);
insert into history(ser_id, his_status) values (270, 1);
insert into history(ser_id, his_status) values (271, 1);
insert into history(ser_id, his_status) values (272, 1);
insert into history(ser_id, his_status) values (273, 1);
insert into history(ser_id, his_status) values (274, 1);
insert into history(ser_id, his_status) values (275, 1);
insert into history(ser_id, his_status) values (276, 1);
insert into history(ser_id, his_status) values (277, 1);
insert into history(ser_id, his_status) values (278, 1);
insert into history(ser_id, his_status) values (279, 1);
insert into history(ser_id, his_status) values (280, 1);
insert into history(ser_id, his_status) values (281, 1);
insert into history(ser_id, his_status) values (282, 1);
insert into history(ser_id, his_status) values (283, 1);
insert into history(ser_id, his_status) values (284, 1);
insert into history(ser_id, his_status) values (285, 1);
insert into history(ser_id, his_status) values (286, 1);
insert into history(ser_id, his_status) values (287, 1);
insert into history(ser_id, his_status) values (288, 1);
insert into history(ser_id, his_status) values (289, 1);
insert into history(ser_id, his_status) values (290, 1);
insert into history(ser_id, his_status) values (291, 1);
insert into history(ser_id, his_status) values (292, 1);
insert into history(ser_id, his_status) values (293, 1);
insert into history(ser_id, his_status) values (294, 1);
insert into history(ser_id, his_status) values (295, 1);
insert into history(ser_id, his_status) values (296, 1);
insert into history(ser_id, his_status) values (297, 1);
insert into history(ser_id, his_status) values (298, 1);
insert into history(ser_id, his_status) values (299, 1);
insert into history(ser_id, his_status) values (300, 1);
insert into history(ser_id, his_status) values (301, 1);
insert into history(ser_id, his_status) values (302, 1);
insert into history(ser_id, his_status) values (303, 1);
insert into history(ser_id, his_status) values (304, 1);
insert into history(ser_id, his_status) values (305, 1);
insert into history(ser_id, his_status) values (306, 1);
insert into history(ser_id, his_status) values (307, 1);
insert into history(ser_id, his_status) values (308, 1);
insert into history(ser_id, his_status) values (309, 1);
insert into history(ser_id, his_status) values (310, 1);
insert into history(ser_id, his_status) values (311, 1);
insert into history(ser_id, his_status) values (312, 1);
insert into history(ser_id, his_status) values (313, 1);
insert into history(ser_id, his_status) values (314, 1);
insert into history(ser_id, his_status) values (315, 1);
insert into history(ser_id, his_status) values (316, 1);
insert into history(ser_id, his_status) values (317, 1);
insert into history(ser_id, his_status) values (318, 1);
insert into history(ser_id, his_status) values (319, 1);
insert into history(ser_id, his_status) values (320, 1);
insert into history(ser_id, his_status) values (321, 1);
insert into history(ser_id, his_status) values (322, 1);
insert into history(ser_id, his_status) values (323, 1);
insert into history(ser_id, his_status) values (324, 1);
insert into history(ser_id, his_status) values (325, 1);
insert into history(ser_id, his_status) values (326, 1);
insert into history(ser_id, his_status) values (327, 1);
insert into history(ser_id, his_status) values (328, 1);
insert into history(ser_id, his_status) values (329, 1);
insert into history(ser_id, his_status) values (330, 1);
insert into history(ser_id, his_status) values (331, 1);
insert into history(ser_id, his_status) values (332, 1);
insert into history(ser_id, his_status) values (333, 1);
insert into history(ser_id, his_status) values (334, 1);
insert into history(ser_id, his_status) values (335, 1);
insert into history(ser_id, his_status) values (336, 1);
insert into history(ser_id, his_status) values (337, 1);
insert into history(ser_id, his_status) values (338, 1);
insert into history(ser_id, his_status) values (339, 1);
insert into history(ser_id, his_status) values (340, 1);
insert into history(ser_id, his_status) values (341, 1);
insert into history(ser_id, his_status) values (342, 1);
insert into history(ser_id, his_status) values (343, 1);
insert into history(ser_id, his_status) values (344, 1);
insert into history(ser_id, his_status) values (345, 1);
insert into history(ser_id, his_status) values (346, 1);
insert into history(ser_id, his_status) values (347, 1);
insert into history(ser_id, his_status) values (348, 1);
insert into history(ser_id, his_status) values (349, 1);
insert into history(ser_id, his_status) values (350, 1);
insert into history(ser_id, his_status) values (351, 1);
insert into history(ser_id, his_status) values (352, 1);
insert into history(ser_id, his_status) values (353, 1);
insert into history(ser_id, his_status) values (354, 1);
insert into history(ser_id, his_status) values (355, 1);
insert into history(ser_id, his_status) values (356, 1);
insert into history(ser_id, his_status) values (357, 1);
insert into history(ser_id, his_status) values (358, 1);
insert into history(ser_id, his_status) values (359, 1);
insert into history(ser_id, his_status) values (360, 1);
insert into history(ser_id, his_status) values (361, 1);
insert into history(ser_id, his_status) values (362, 1);
insert into history(ser_id, his_status) values (363, 1);
insert into history(ser_id, his_status) values (364, 1);
insert into history(ser_id, his_status) values (365, 1);
insert into history(ser_id, his_status) values (366, 1);
insert into history(ser_id, his_status) values (367, 1);
insert into history(ser_id, his_status) values (368, 1);
insert into history(ser_id, his_status) values (369, 1);
insert into history(ser_id, his_status) values (370, 1);
insert into history(ser_id, his_status) values (371, 1);
insert into history(ser_id, his_status) values (372, 1);
insert into history(ser_id, his_status) values (373, 1);
insert into history(ser_id, his_status) values (374, 1);
insert into history(ser_id, his_status) values (375, 1);
insert into history(ser_id, his_status) values (376, 1);
insert into history(ser_id, his_status) values (377, 1);
insert into history(ser_id, his_status) values (378, 1);
insert into history(ser_id, his_status) values (379, 1);
insert into history(ser_id, his_status) values (380, 1);
insert into history(ser_id, his_status) values (381, 1);
insert into history(ser_id, his_status) values (382, 1);
insert into history(ser_id, his_status) values (383, 1);
insert into history(ser_id, his_status) values (384, 1);
insert into history(ser_id, his_status) values (385, 1);
insert into history(ser_id, his_status) values (386, 1);
insert into history(ser_id, his_status) values (387, 1);
insert into history(ser_id, his_status) values (388, 1);
insert into history(ser_id, his_status) values (389, 1);
insert into history(ser_id, his_status) values (390, 1);
insert into history(ser_id, his_status) values (391, 1);
insert into history(ser_id, his_status) values (392, 1);
insert into history(ser_id, his_status) values (393, 1);
insert into history(ser_id, his_status) values (394, 1);
insert into history(ser_id, his_status) values (395, 1);
insert into history(ser_id, his_status) values (396, 1);
insert into history(ser_id, his_status) values (397, 1);
insert into history(ser_id, his_status) values (398, 1);
insert into history(ser_id, his_status) values (399, 1);
insert into history(ser_id, his_status) values (400, 1);
insert into history(ser_id, his_status) values (401, 1);
insert into history(ser_id, his_status) values (402, 1);
insert into history(ser_id, his_status) values (403, 1);
insert into history(ser_id, his_status) values (404, 1);
insert into history(ser_id, his_status) values (405, 1);
insert into history(ser_id, his_status) values (406, 1);
insert into history(ser_id, his_status) values (407, 1);
insert into history(ser_id, his_status) values (408, 1);
insert into history(ser_id, his_status) values (409, 1);
insert into history(ser_id, his_status) values (410, 1);
insert into history(ser_id, his_status) values (411, 1);
insert into history(ser_id, his_status) values (412, 1);
insert into history(ser_id, his_status) values (413, 1);
insert into history(ser_id, his_status) values (414, 1);
insert into history(ser_id, his_status) values (415, 1);
insert into history(ser_id, his_status) values (416, 1);
insert into history(ser_id, his_status) values (417, 1);
insert into history(ser_id, his_status) values (418, 1);
insert into history(ser_id, his_status) values (419, 1);
insert into history(ser_id, his_status) values (420, 1);
insert into history(ser_id, his_status) values (421, 1);
insert into history(ser_id, his_status) values (422, 1);
insert into history(ser_id, his_status) values (423, 1);
insert into history(ser_id, his_status) values (424, 1);
insert into history(ser_id, his_status) values (425, 1);
insert into history(ser_id, his_status) values (426, 1);
insert into history(ser_id, his_status) values (427, 1);
insert into history(ser_id, his_status) values (428, 1);
insert into history(ser_id, his_status) values (429, 1);
insert into history(ser_id, his_status) values (430, 1);
insert into history(ser_id, his_status) values (431, 1);
insert into history(ser_id, his_status) values (432, 1);
insert into history(ser_id, his_status) values (433, 1);
insert into history(ser_id, his_status) values (434, 1);
insert into history(ser_id, his_status) values (435, 1);
insert into history(ser_id, his_status) values (436, 1);
insert into history(ser_id, his_status) values (437, 1);
insert into history(ser_id, his_status) values (438, 1);
insert into history(ser_id, his_status) values (439, 1);
insert into history(ser_id, his_status) values (440, 1);
insert into history(ser_id, his_status) values (441, 1);
insert into history(ser_id, his_status) values (442, 1);
insert into history(ser_id, his_status) values (443, 1);
insert into history(ser_id, his_status) values (444, 1);
insert into history(ser_id, his_status) values (445, 1);
insert into history(ser_id, his_status) values (446, 1);
insert into history(ser_id, his_status) values (447, 1);
insert into history(ser_id, his_status) values (448, 1);
insert into history(ser_id, his_status) values (449, 1);
insert into history(ser_id, his_status) values (450, 1);
insert into history(ser_id, his_status) values (451, 1);
insert into history(ser_id, his_status) values (452, 1);
insert into history(ser_id, his_status) values (453, 1);
insert into history(ser_id, his_status) values (454, 1);
insert into history(ser_id, his_status) values (455, 1);
insert into history(ser_id, his_status) values (456, 1);
insert into history(ser_id, his_status) values (457, 1);
insert into history(ser_id, his_status) values (458, 1);
insert into history(ser_id, his_status) values (459, 1);
insert into history(ser_id, his_status) values (460, 1);
insert into history(ser_id, his_status) values (461, 1);
insert into history(ser_id, his_status) values (462, 1);
insert into history(ser_id, his_status) values (463, 1);
insert into history(ser_id, his_status) values (464, 1);
insert into history(ser_id, his_status) values (465, 1);
insert into history(ser_id, his_status) values (466, 1);
insert into history(ser_id, his_status) values (467, 1);
insert into history(ser_id, his_status) values (468, 1);
insert into history(ser_id, his_status) values (469, 1);
insert into history(ser_id, his_status) values (470, 1);
insert into history(ser_id, his_status) values (471, 1);
insert into history(ser_id, his_status) values (472, 1);
insert into history(ser_id, his_status) values (473, 1);
insert into history(ser_id, his_status) values (474, 1);
insert into history(ser_id, his_status) values (475, 1);
insert into history(ser_id, his_status) values (476, 1);
insert into history(ser_id, his_status) values (477, 1);
insert into history(ser_id, his_status) values (478, 1);
insert into history(ser_id, his_status) values (479, 1);
insert into history(ser_id, his_status) values (480, 1);
insert into history(ser_id, his_status) values (481, 1);
insert into history(ser_id, his_status) values (482, 1);
insert into history(ser_id, his_status) values (483, 1);
insert into history(ser_id, his_status) values (484, 1);
insert into history(ser_id, his_status) values (485, 1);
insert into history(ser_id, his_status) values (486, 1);
insert into history(ser_id, his_status) values (487, 1);
insert into history(ser_id, his_status) values (488, 1);
insert into history(ser_id, his_status) values (489, 1);
insert into history(ser_id, his_status) values (490, 1);
insert into history(ser_id, his_status) values (491, 1);
insert into history(ser_id, his_status) values (492, 1);
insert into history(ser_id, his_status) values (493, 1);
insert into history(ser_id, his_status) values (494, 1);
insert into history(ser_id, his_status) values (495, 1);
insert into history(ser_id, his_status) values (496, 1);
insert into history(ser_id, his_status) values (497, 1);
insert into history(ser_id, his_status) values (498, 1);
insert into history(ser_id, his_status) values (499, 1);
insert into history(ser_id, his_status) values (500, 1);

以上是关于sql MySQL的查询优化的一个例子的主要内容,如果未能解决你的问题,请参考以下文章

mysql分页查询优化

Mysql分页优化(100000条数据以上的查询),求指点~方法~ 有例子更好,网上的没看懂~

sql优化之大数据量分页查询(mysql)

mysql 优化例子:IN 换 INNER JOIN

数据库优化——慢查询MySQL定位优化流程

数据库优化——慢查询MySQL定位优化流程