mysql
文章平均质量分 62
nextvary
这个作者很懒,什么都没留下…
展开
-
【实战】Mysql 千万级数据表结构变更 、含脚本
千万级数据表解构变更原创 2022-11-05 17:07:27 · 799 阅读 · 1 评论 -
mysql优化 索引
一.定长 int(4):不代表只能存4个字符,只有 zerofill 时候有效,能够看出区别,且只有在命令行下可以看出区别 time:定长 char(4):定长 4个字符,而不是字节 renf是四个字符 1234是四个字符 tinyint 1,2,3,4,5 与char a,b,c,d,e 相比 order by时候要快 char要考虑字符集与校对集 二.添加索引 添加唯一索引 alter t原创 2017-04-18 17:20:57 · 306 阅读 · 0 评论 -
定时备份mysql 数据库
1, ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump2,新建bf.sh chmod 777 bf.sh#!/bin/bash if [ ! -d '/home/beifen' ] then mkdir -p /home/beifen ficd /home/beifen mysqldump -h127.0.0.1 -uroot -p*原创 2017-04-19 16:13:00 · 353 阅读 · 0 评论 -
mysql 按月,周 查询,mysql日期函数
按月查询select from_unixtime(start_time,'%Y-%m') as 'yue',count('yue') as shuliang from br_collect GROUP BY yue 1.select from_unixtime(‘1491408000’,’%Y-%m’) 格式为标准时间 2. select unix_timestamp(‘2017-03原创 2017-04-20 15:20:37 · 4750 阅读 · 0 评论 -
mysql 分组统计(直播内容状态,带上内容id),count case when group_concat sql
SELECT group_concat(case live_status when 0 then content_id end) as closed_ids, group_concat(case live_status when 1 then content_id when 2 then content_id end) as unclosed_ids, count(case live_status...原创 2018-03-22 16:46:44 · 414 阅读 · 0 评论