mysql
文章平均质量分 50
wt_better
爱编程爱交友的~better
展开
-
类方法调用导致事务失效
类方法调用导致事务失效原创 2022-06-29 21:46:01 · 530 阅读 · 0 评论 -
SQL事务隔离级别参考资料
1、ANSI SQL-922、ANSI SQL-993、A Critique of ANSI SQL Isolation Levels4、TiDB 的隔离级别5、OCEANBASE的事务隔离级别原创 2022-02-17 22:30:05 · 269 阅读 · 0 评论 -
JDBC 事务rollback失败会产生什么情况
先说下结论:事务没有rollback或者rollback失败的情况下,如果是相同的connection(数据库连接池会复用连接),可能会产生数据不一致的场景。begin;insert into test (id, name) values (2,'ning');insert into test (id, name) values (1,'ruler');//commit or rollback,如果上面的第二句sql执行异常,比如dupKey,业务层的事物将会回滚,这里未回滚或者回滚失败,原创 2022-01-29 10:16:51 · 2241 阅读 · 0 评论 -
Mysql 客户端预编译和服务端预编译
参考:https://blog.csdn.net/xieyuooo/article/details/10732375转载 2022-01-28 16:16:45 · 446 阅读 · 0 评论 -
MySQL 字段类型占用空间
目录Number TypeDate and Time TypeString TypeNumber TypeData TypeStorage RequiredTINYINT1 byteSMALLINT2 bytesMEDIUMINT3 bytesINT, INTEGER4 bytesBIGINT8 bytesFLOAT§4 bytes if 0 <= p <= 24, 8 bytes if 25 <= p <= 53原创 2021-12-28 20:16:01 · 552 阅读 · 0 评论 -
mysql 获取db表记录行数
SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'xxx' ORDER BY table_rows DESC 什么情况下需要该sql?比如:做DB数据迁移时,探测哪些表有数据,以决定迁移哪些表。原创 2021-12-28 20:01:17 · 330 阅读 · 0 评论 -
LAST_INSERT_ID
目录LAST_INSERT_ID()LAST_INSERT_ID(expr)Mysql LAST_INSERT_ID函数有两种表达形式,分别是:LAST_INSERT_ID()LAST_INSERT_ID(expr)LAST_INSERT_ID()With no argument, LAST_INSERT_ID() returns a BIGINT UNSIGNED (64-bit) value representing the first automatically generated va原创 2021-12-11 18:27:42 · 2936 阅读 · 0 评论 -
Mysql SUBSTRING函数
SUBSTRING,有如下几种用法注:SUBSTR和SUBSTRING函数含义相同SUBSTRING(str,pos)SUBSTRING(str,pos,len)SUBSTRING(str,pos)SUBSTRING(str,pos),表示SUBSTRING(str FROM pos),从pos位置开始截取。select substr('123456',2);//从第二位开始截取23456select substr('123456',10);//从第10位开始截取,返回空字符串原创 2021-11-28 10:15:25 · 2349 阅读 · 0 评论 -
Query execution was interrupted
MYSQL ErrorError number: 1317; Symbol: ER_QUERY_INTERRUPTED; SQLSTATE: 70100Message: Query execution was interrupted异常原因一、JDBC setQueryTimeout如果设置了queryTimeout参数,JDBC后台会启动一个Timer,内部是一个CancelTask,当sql执行时间超过预设置的时间时会主动Kill query。//create Timertimeout原创 2021-11-01 00:50:04 · 12092 阅读 · 0 评论 -
链接MySQL服务端命令
一、本地链接隐藏密码[root@host]# mysql -u root -pEnter password:******mysql -h localhost -u root -p Enter password:******显示密码[root@host]# mysql -u root -p123mysql -h localhost -u root -p123二、远程链接隐藏密码mysql -h 192.168.5.116 -P 3306 -u root -pEnter pass原创 2020-10-22 18:38:56 · 583 阅读 · 0 评论 -
MySQL时间戳精度
现象应用MySQL Connector/J(mysql-connector-java)升级,由5.1.20升级到5.1.30。灰度发布后,发现查询功能异常,按照时间查询不到之前创建过的订单了。private Date searchDate;对应查询SQL如下所示:其中MySQL中order_tbl表中的create_timestamp字段为TimeStamp类型。select * from order_tbl where create_timestamp = #{searchDate}排查过原创 2021-06-29 21:04:43 · 1267 阅读 · 1 评论 -
Mysql Server 开启日志输出
目录General Query Log(通用查询日志)查询General Query Log 状态开启General Query LogSlow Query Log(慢查询日志)查询Slow Query Log状态开启Slow Query LogGeneral Query Log(通用查询日志)查询General Query Log 状态SHOW VARIABLES LIKE 'general%';或者SHOW VARIABLES WHERE Variable_name = 'general_l原创 2021-08-18 23:20:48 · 577 阅读 · 0 评论 -
Every derived table must have its own alias
A derived table is an expression that generates a table within thescope of a query FROM clause. For example, a subquery in a SELECTstatement FROM clause is a derived table:SELECT ... FROM (subquery) [AS] tbl_name ...The [AS] tbl_name clause is mand.原创 2020-12-26 12:11:53 · 166 阅读 · 0 评论 -
DB出现大量select @@session.tx_read_only 语句
文章目录序详序MySQL JDBC Driver 在 5.1.36 以下的版本且数据库版本大于 5.6.5,在每次 update/insert/delete 请求时,均会向后端数据库发送 select @@tx_read_only 命令,判断下是否是只读。说明:5.1.36 以上,如果使用 execute() 而不是 executeUpdate() 方法的话,依然会发送 select @@tx_read_only 方法,参考 PreparedStatement#checkReadOnlySafe原创 2020-09-07 11:35:38 · 2990 阅读 · 0 评论 -
Transaction Isolation Levels
https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html原创 2019-06-04 20:29:32 · 177 阅读 · 0 评论 -
mysql 命令备忘
开启Innodb monitorSET GLOBAL innodb_status_output=ON;SET GLOBAL innodb_status_output_locks=ON;SET GLOBAL innodb_status_output=OFF;SET GLOBAL innodb_status_output_locks=OFF;获取当前锁信息SELECT * FROM I...原创 2019-06-04 20:17:13 · 193 阅读 · 0 评论 -
MySQL How to add a column in a table?
MySQL 已存在表中增加列原创 2017-07-07 19:43:15 · 573 阅读 · 0 评论