mysql order group

Java旺

关注

阅读 83

2022-06-27

##order by排序的字段若有重复则创建索引时可以加一个唯一索引的字段创建索引  alter table employee add index ind_birth_empno(birth,emp_no)

##分页优化 若limit(limit 10000000,20表示从一千万中取前20条)比较大时后面的分页比较慢  优化创建索引:1、alter table employee add index ind_birth_empno(birth,emp_no) 2、 select * from employee order by birth_date,emp_no limit 30; 3、select * from employee where (birth,emp_no)>('1987-02-03',456258) order by birth_date,emp_no limit 30; ##where条件是从上一页数据中最后一条的数据

s how variables like 'sort_buffer_%';  

show variables like 'tmp_%';

mysql order group_字段

###sort_merge_passes比较大时需要增加sort_buffer_size大小

 

 mysql order group_分页_02

###created_tmp_disk_tables比较大时需要增加tmp_table_size大小

 

 

mysql order group_字段_03

 ##group concat()函数

mysql order group_字段_04

 

 mysql order group_分页_05

 


精彩评论(0)

0 0 举报