mysql
WinkingJay
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
mysql 优化sql语句的几种方法
mysql 优化sql语句的几种方法 </h1> <div class="clear"></div> <div class="postBody"> <div id="cnblogs_post_description" style="display: none"> 数据库 mysql 优化sql语句的几种方法 1、通过show sta...转载 2021-07-05 15:28:16 · 154 阅读 · 0 评论 -
like模糊匹配优化
https://mp.weixin.qq.com/s/ygvuP35B_sJAlBHuuEJhfg 有时间自己总结一下再写 1.ICP 2.列与主键建立联合索引 3.全文索引 4.生成列原创 2021-07-05 15:08:48 · 184 阅读 · 0 评论 -
mysql ICP(Index Condition Pushdown)
MySQL 5.6开始支持ICP 不支持ICP时,先在存储引擎层进行索引查询,查询出的结果在server层通过其他的where条件过滤。 支持ICP时,会将where条件放在存储引擎层过滤,减少了数据扫描IO开销 show variables like ‘optimizer_switch’; set optimizer_switch = ‘index_condition_pushdown=on | off’; ...原创 2021-07-05 14:55:45 · 165 阅读 · 0 评论 -
order by id
select * from table order by id index索引 触发条件: 只扫描索引树 1)查询的字段是索引的一部分,覆盖索引。2)使用主键进行排序原创 2021-07-04 23:30:12 · 407 阅读 · 0 评论 -
查询子表最新的一条数据并与主表关联
select scp.*,ar.audit_unit from scheme_compile_plan scp left join audit_record ar on scp.id = ar.biz_id where ar.biz_type = #{bizType} order by ar.audit_finish_time desc limit 1)原创 2021-06-20 16:27:40 · 1257 阅读 · 0 评论 -
MySQL已经创建的表转换字符集
alter table newtable default character set = utf8mb4; alter table newtable convert to character set utf8mb4;原创 2021-06-19 19:00:30 · 147 阅读 · 0 评论 -
bat脚本操作数据库
bat文件 "D:\Program Files\mysql-8.0.19-winx64\bin\mysql.exe" -uroot -h 192.168.1.52 -p123456 gantrycranes_qqctn<"C:\Users\leohe\Desktop\deleteVesselInfo.sql">>D:\dblog.txt 2>&1 pause sql文件 USE `gantrycranes_qqctn`; delete from berth_pla.原创 2021-04-28 16:36:11 · 560 阅读 · 0 评论 -
mysql触发器定时删除15天前的数据
DELIMITER $$ USE `gantrycranes_qqctn`$$ CREATE DEFINER=`root`@`%` PROCEDURE `deleteVesselInfo`() BEGIN delete from berth_plan where (TO_DAYS(NOW()) - TO_DAYS(create_time))>=15; delete from vessel_listing where (TO_DAYS(NOW()) - TO_DAYS(create_time))>原创 2021-04-28 15:36:32 · 904 阅读 · 0 评论
分享