摘要: 创建测试数据 use testdb db.test_t.insertOne({_id:1,name:'zhangsan',age:30}); db.test_t.insertOne({_id:2,name:'lisi',age:33}); db.test_t.insertOne({_id:3,nam 阅读全文
posted @ 2025-06-13 07:54 kahnyao 阅读(5) 评论(0) 推荐(0)
摘要: 问题背景 用户反馈删除序列失败,报锁超时的错误,排查发现因为该序列被使用,所以没法删除。 尝试kill持锁的会话,但是kill不掉,尝试重启数据库也失败,最终重启主机,启动数据库后才成功删除序列。 问题分析 检查发现序列定义有问题,用户使用navicat、dbeaver等图像界面修改序列当前值,由于 阅读全文
posted @ 2025-06-11 04:12 kahnyao 阅读(9) 评论(0) 推荐(0)
摘要: 查询表预估占用的页数量 select relname,relpages from pg_class where relnamespace::regnamespace::text = '模式名' and relname = '表名'; 实际数据页数量 -- 实际占用的数据页 select count( 阅读全文
posted @ 2025-06-05 23:41 kahnyao 阅读(3) 评论(0) 推荐(0)
摘要: 平时查询一些系统表或视图,可以使用字段名或者表名进行模糊查询 根据表或视图关键字查询 select table_catalog,table_schema,table_name,table_type from information_schema.tables where table_type in 阅读全文
posted @ 2025-06-05 23:28 kahnyao 阅读(11) 评论(0) 推荐(0)
摘要: 相关参数说明 innodb_large_prefix Command-Line Format --innodb-large-prefix=ON Deprecated Yes System Variable innodb_large_prefix Scope Global Dynamic Yes Ty 阅读全文
posted @ 2025-06-03 00:28 kahnyao 阅读(15) 评论(0) 推荐(0)
摘要: 支持的匹配模式(常用) 定位符 符号 描述 ^ 匹配输入字符串的开始位置。如果设置了 RegExp 对象的 Multiline 属性,^ 也匹配 '\n' 或 '\r' 之后的位置。 $ 匹配输入字符串的结束位置。如果设置了RegExp 对象的 Multiline 属性,$ 也匹配 '\n' 或 ' 阅读全文
posted @ 2025-05-30 01:34 kahnyao 阅读(39) 评论(0) 推荐(0)
摘要: 查询自定义对象ddl时间 select pc.relname, case object_type when 'r' then '普通表' when 'i' then '索引' when 's' then '序列' when 'v' then '视图' when 'p' then '存储过程和函数' 阅读全文
posted @ 2025-05-29 23:18 kahnyao 阅读(7) 评论(0) 推荐(0)
摘要: unix_timestamp MySQL 中的 unix_timestamp() 函数返回自 1970 年 1 月 1 日 UTC 时间以来的秒数。在 PostgreSQL 中,可以通过 EXTRACT 和 EPOCH 来获取这一信息。 CREATE OR REPLACE FUNCTION unix 阅读全文
posted @ 2025-05-28 22:52 kahnyao 阅读(9) 评论(0) 推荐(0)
摘要: 创建表结构 drop table if exists history; drop table if exists history_str; drop table if exists history_log; drop table if exists history_text; drop table 阅读全文
posted @ 2025-05-28 21:28 kahnyao 阅读(2) 评论(0) 推荐(0)
摘要: 创建表结构 drop table if exists history; drop table if exists history_str; drop table if exists history_log; drop table if exists history_text; drop table 阅读全文
posted @ 2025-05-28 21:27 kahnyao 阅读(3) 评论(0) 推荐(0)
点击右上角即可分享
微信分享提示