上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页
摘要: 1、指定读取的配置路径 配置在 application.yml 文件里面 server: port: ${SERVER_PORT:10102} spring: application: name: config profiles: active: ${PROFILE:native} manageme 阅读全文
posted @ 2023-02-14 18:19 aaacarrot 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 按进程消耗内存多少排序的方法 ps -e -o 'pid,comm,args,pcpu,rsz,vsz,stime,user,uid' --sort -rsz | more 参数解析: -e 显示所有进程 -o 定制显示信息 pid 进程ID comm 进程名 args 启动命令 pcpu 占用CP 阅读全文
posted @ 2023-02-14 17:41 aaacarrot 阅读(244) 评论(0) 推荐(0) 编辑
摘要: echo "get key" | redis-cli -h 127.0.0.1 -p 6379 -a '123456' -n 5 > /tmp/redis_data.log 因为在命令行输入了密码,会报一个警告:redis using a password on the command line 但 阅读全文
posted @ 2023-02-14 11:58 aaacarrot 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 和普通字段差不多 <if test="flag==true"> <if test="flag"> <if test="!flag"> 阅读全文
posted @ 2023-02-10 15:34 aaacarrot 阅读(26) 评论(0) 推荐(0) 编辑
摘要: mysql 只有三种 join方式 参考: https://www.jianshu.com/p/76c90b03b7bd mysql 只有三种 join方式,但通过组合可以达到各种效果而已 join 就是 inner join left join right join full join(oracl 阅读全文
posted @ 2023-02-10 15:32 aaacarrot 阅读(49) 评论(0) 推荐(0) 编辑
摘要: | 中间件名称 |介绍| 优点 | 缺点 | | | | | | | sharding-JDBC | 当当应用框架ddframe中,从关系型数据库模块dd-rdb中分离出来的数据库水平分片框架,实现透明化数据库分库分表访问 | (1)旧代码迁移成本几乎为零 (2)可适用于任何基于Java的ORM框架 阅读全文
posted @ 2023-02-10 11:24 aaacarrot 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 比较器 Comparator 接口 lamda 表达式定法 和 比较器类写法 public class StringComparator implements Comparator<String> { @Override public int compare(String s1, String s2 阅读全文
posted @ 2023-02-10 11:19 aaacarrot 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 问题描述 1、根据某个字段倒序,如果这个字段里面有部分空值, 那么空值会排在前面, 怎样把空值放到后面呢? 解决方案 之一:加个 null last select t.top_time, t.updateat from publish_info t ORDER BY t.TOP_TIME DESC 阅读全文
posted @ 2023-02-09 20:40 aaacarrot 阅读(417) 评论(0) 推荐(0) 编辑
摘要: 直接看代码得了 是使用配置类进行分库分表设置 还可以使用配置文件进行配置 代码详情 pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi= 阅读全文
posted @ 2023-02-08 16:50 aaacarrot 阅读(20) 评论(0) 推荐(0) 编辑
摘要: List 转 String (用分隔符隔开) 使用for 循环 + StringBuilder 的 方式就不记了, 写一种相对简约一点的做法: public String listToString(List list, char separator) { return org.apache.comm 阅读全文
posted @ 2023-02-07 10:36 aaacarrot 阅读(1428) 评论(0) 推荐(0) 编辑
摘要: 没有亲自做过试验,是从网上看帖子得到的结论。记录一下 先说结论 子表数据量比外表数据量少,使用in。 子表数据量比外表数据量大,使用exists。 子表与外表数据量大小差不多,用in与exists的效率相差不大。 无论那个表大,用not exists都比not in要快。 再来分析(引用一些结论) 阅读全文
posted @ 2023-02-06 20:51 aaacarrot 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 上代码 一开始是这样写的: void insertArticleArea(@Param("articleId") Integer articleId, @Param("list") List list) ; 报错,找不到 "list" 然后换个参数名,改为 void insertArticleAre 阅读全文
posted @ 2023-02-06 17:31 aaacarrot 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 一开始是这样写的: <insert id="insertArticle" useGeneratedKeys="true" keyProperty="id"> xxxx </insert> 期望获取从 实体中拿到 id, id 是空的。但数据是有成功写进去了。 然后再加一个参数: keyColumn= 阅读全文
posted @ 2023-02-06 16:35 aaacarrot 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 背景 描述一次生产事故 在生产环境上,做表备份(create tablex user_1001 as select * from user),做了一些验证,做完验证后要把数据恢复回来,为了方便操作,把 user drop 掉之后,再用相同的方法,把 user_1001 复制为 user 表,再把 u 阅读全文
posted @ 2023-02-06 10:24 aaacarrot 阅读(264) 评论(1) 推荐(0) 编辑
摘要: 背景 一次上线过程,搞了一个现网事故, 过程是这样子的, 部署之后,要做一些数据验证,于是对表做了一个备份,计划备份好后,测试一把,再把数据还原。 于是用的是 create table xx01 as select * from xx; 嗯,看到表和数据都被复制了,感觉很美好, 等测试完, 再把 x 阅读全文
posted @ 2023-02-02 15:45 aaacarrot 阅读(359) 评论(1) 推荐(0) 编辑
摘要: 背景 想要做数据同步,但不知道待同步的数据是新增或更新 于是想,如果数据库可以识别 InsertOrUpdate 就好了 使用的是达梦数据库 but: 1、达梦是没有 ON DUPLICATE KEY UPDATE 这样的语句的 2、达梦有merge into语句,可以平替一下。(虽然莫名感觉性能不 阅读全文
posted @ 2023-02-02 15:08 aaacarrot 阅读(2568) 评论(0) 推荐(0) 编辑
摘要: 文章是转载网络上的, 内容贴过来,格式乱了, 建议参考原文: 【MyBatis】几种批量插入效率的比较 批处理数据主要有三种方式: 反复执行单条插入语句 foreach 拼接 sql 批处理 一、前期准备 基于Spring Boot + Mysql,同时为了省略get/set,使用了lombok,详 阅读全文
posted @ 2023-02-02 14:58 aaacarrot 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 背景 业务系统中经常有批量导入的功能。 导入的数据里面,因为不清楚这些数据是新增的或是更新的,所以默认的一种做法是,先查一下,然后分出哪些是新增的数据,哪些是更新的数据, 然后再分新增和更新。 理论是这样子,但总感觉每次都要查询一下,也不是很舒服。 有一个想法 如果一个批次,100条数据, 如果先不 阅读全文
posted @ 2023-02-02 14:33 aaacarrot 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 查看表(库,表) select table_name from user_tables; //当前用户的表 (这个查询的表比较少) select table_name from all_tables; //所有用户的表 (全部的表) select table_name from dba_tables 阅读全文
posted @ 2023-02-01 19:55 aaacarrot 阅读(5446) 评论(0) 推荐(0) 编辑
摘要: 1、cherry-pick 如果选择多个commit,它会聚成一次提交(生成一个新的提交) 参考: git cherry-pick 使用指南 阅读全文
posted @ 2023-02-01 16:00 aaacarrot 阅读(49) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 14 下一页