1. select * from test  where a=xx group by b order by c   如何加索引

CREATE TABLE `index_test` (

`id` int(10) unsigned NOT NULL AUTO_INCREMENT,

`name` varchar(100) NOT NULL DEFAULT '',

`gid` int(11) NOT NULL DEFAULT '0',

`age` int(11) NOT NULL DEFAULT '0',

PRIMARY KEY (`id`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8

MysqL> select * from index_test;

+----+------------+-----+

| id | name | gid |

+----+------------+-----+

| 1 | taoshihan | 2 |

| 2 | taoshihan1 | 2 |

+----+------------+-----+

2. 加个联合索引试试

alter table index_test add index name_gid_age_index(name,gid,age);

explain select * from index_test where name='taoshihan' group by gid order by age;

mysql group where_[MySQL] 测试where group by order by的索引问题相关推荐

  1. mysql 索引使用测试(group by、order by)

    mysql 索引使用测试(group by.order by) ************************** 测试表 字段:id.name.age.distance 插入10万条数据 drop ...

  2. MySQL高可用框架--组复制(group replication)搭建测试

    一.框架搭建       1.首先备份主库数据,有两种方法,冷备份和热备份.冷备份需要先停止master服务,sudo/etc/init.d/mysql stop,然后通过cp或者scp等命令将数据文 ...

  3. mysql去重查询group_MySQL distinct 与 group by 去重(where/having)

    MySQL中常用去重复数据的方法是使用 distinct  或者 group by ,以上2种均能实现,但2者也有不同的地方. distinct 特点: 如:select distinct name, ...

  4. mysql group b_mysql报错之5.7版本的 group by mysql不能使用group by

    mysql 查询提示 SELECT list is not in GROUP BY clause and contains nonaggregated column 'user_login.user_ ...

  5. [MySQL 5.6] MySQL 5.6 group commit 性能测试及内部实现流程

    [MySQL 5.6] MySQL 5.6 group commit 性能测试及内部实现流程 http://mysqllover.com/?p=581 尽管Mariadb以及Facebook在long ...

  6. mysql中没having_MySQL中无GROUP BY直接HAVING的问题

    今天有同学给我反应,有一张表,id是主键,这样的写法可以返回一条记录: "SELECT * FROM t HAVING id=MIN(id);" 但是只是把MIN换成MAX,这样返 ...

  7. mysql+distinct+max_MySQL 中 distinct 和 group by 性能比较-Fun言

    看了网上的一些测试,感觉不是很准确,今天亲自测试了一番.得出了结论 仅在个人计算机上测试,可能不全面,仅供参考 测试过程 准备一张测试表 CREATE TABLE `test_test` ( `id` ...

  8. mysql:In aggregated query without GROUP BY, expression #1 of SELECT list contains...........

    文章目录 问题描述 问题溯源 解决方式一 解决方法二 附录: 问题描述 下面是报错截图: 1140 - In aggregated query without GROUP BY, expression ...

  9. mysql去重后的count_MYSQL用group by去重后,再用count计算条数

    我就废话不多说了,大家还是直接看代码吧~create or replace function aa1(a1 integer[],a2 bigint) returns void AS $$declare ...

最新文章

  1. 模型加速--LCNN: Lookup-based Convolutional Neural Network
  2. 怎么看rabbitmq的浏览器信息_买房沙盘怎么看?沙盘也可以看出很多信息的
  3. 【洛谷P1381】单词背诵
  4. 大数据容器化-基于Kubernetes(k8s)构建spark运行环境
  5. 使用SVD求最小二乘刚性转置
  6. Golang 推荐的命名规范
  7. 支付宝jsapi_使用小程序Serverless开发支付宝小程序
  8. 小米获京东自营安卓平板销量冠军 小米平板5 Pro全版本闪降100元
  9. 可重入函数 与线程安全的区别与联系
  10. BurpSuite使用——HTTP
  11. vue获取原生html节点,vue是如何获取元素节点 ?
  12. win11如何显示所有应用图标 Windows11显示所有应用图标的设置方法
  13. 关于网页内容加速黑科技的趣谈
  14. unity远程协同共享leap手势
  15. IEEE2019_A Survey of Event Extraction from Text
  16. 可能是史上最全的权限系统设计
  17. failed to locate @import file common/stylus/variable.styl
  18. Java设置时间为0时0分0秒和23时59分59秒
  19. Android-布局 协调CoorinatorLayout
  20. 中国石油大学(北京)-《 完井工程》第三阶段在线作业

热门文章

  1. 使用 mono 编译 .NET Standard 应用
  2. 同理心是通往成功架构的桥梁
  3. .Net Core 图片文件上传下载
  4. 【给中高级开发者】构建高性能ASP.NET应用的几点建议
  5. ArcGIS 10.x属性表乱码问题解决办法
  6. C#将dataGridView中显示的数据导出到Excel(大数据量超实用版)
  7. Java之HashMap、Hashtable、LinkedHashMap、TreeMap、ConcurrentHashMap简单的区别
  8. linux之/usr/local/bin和/usr/bin区别
  9. Android之图形图像之使用Path类总结
  10. 《iVX 高仿美团APP制作移动端完整项目》02 搜索、搜索提示及类别需求分析思路及制作流程