上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 52 下一页
摘要: 背景 昨天有现场同事碰到了一个现象,一条简单的update语句运行缓慢。单独运行没有问题,在特定时间运行就会非常缓慢,怀疑是业务系统特殊逻辑导致数据库有阻塞引发的update语句慢的现象。故此现场同事收集了对应时间的kwr报告。 报告分析 首先从dbtime看数据库并没有达到满负荷,依然有上升空间。 阅读全文
posted @ 2022-10-08 09:15 KINGBASE研究院 阅读(225) 评论(0) 推荐(0)
摘要: 背景 前端在客户现场遇到一个问题,模糊查询报错:error:invalid multibyte charactor for locale pg the server LC_TYPE locale is probably incompatible with the database encoding 阅读全文
posted @ 2022-10-08 09:15 KINGBASE研究院 阅读(802) 评论(0) 推荐(0)
摘要: 背景 演示唯一约束怎样创建、删除、禁用和使用唯一性约束,已经多种数据库的差异。 什么是唯一约束 唯一性约束指表中一个字段或者多个字段联合起来可以唯一标识一条记录的约束, 字段中,可以包括空值。 唯一性约束能够在创建表时或使用ALTER TABLE语句创建。 唯一约束与唯一索引的区别 唯一约束和唯一索 阅读全文
posted @ 2022-10-08 09:12 KINGBASE研究院 阅读(300) 评论(0) 推荐(0)
摘要: 一、构建测试数据 create or replace function test_volatile(id integer) returns bigint volatile language sql as $$ select count(*) from t1 $$ ; / create or repl 阅读全文
posted @ 2022-09-23 17:46 KINGBASE研究院 阅读(96) 评论(0) 推荐(0)
摘要: 下表列出了常用的json数据类型操作符: | 操作符 | 操作符右侧数据类型 | 返回类型 | 描述 | | | | | | | -> | int | json or jsonb | 获得 JSON 数组元素(索引从 0 开始,负整数从末尾开始计) | | -> | text | json or j 阅读全文
posted @ 2022-09-16 19:09 KINGBASE研究院 阅读(311) 评论(0) 推荐(0)
摘要: 错误信息产生: 下面的报错一般为有坏块的产生。 test=# select max(create_time) from public.tbl_table where create_time>='2010-11-08'; ERROR: could not read block 365 of relat 阅读全文
posted @ 2022-09-16 19:06 KINGBASE研究院 阅读(169) 评论(0) 推荐(0)
摘要: 说明: 日常业务系统在使用SQL语句进行查询时,开发人员容易将sql查询的子查询放到select语句中进行使用,会造成sql性能的下降。 数据准备: test=# test=# select count(1) from student; count 499 (1 行记录) test=# select 阅读全文
posted @ 2022-09-16 19:01 KINGBASE研究院 阅读(115) 评论(0) 推荐(0)
摘要: 一、数据准备: create table student( id int , s_name varchar(20), t_id int ); create table teacher( id int , t_name varchar(20) ); insert into student values 阅读全文
posted @ 2022-09-16 18:59 KINGBASE研究院 阅读(325) 评论(0) 推荐(0)
摘要: SQL 优化的过程可以分为逻辑优化和物理优化两个部分。逻辑优化主要是基于规则的优化,简称 RBO(Rule-Based Optimization)。物理优化会为逻辑查询计划中的算子选择某个具体的实现,需要用到一些统计信息,决定哪一种方式代价最低,所以是基于代价的优化 CBO(Cost-Based O 阅读全文
posted @ 2022-09-16 18:54 KINGBASE研究院 阅读(239) 评论(0) 推荐(0)
摘要: 判断字符串包含的几种方法: 1. position test=# select position('aa' in 'abcd'); position 0 (1 行记录) test=# select position('ab' in 'abcd'); position 1 (1 行记录) test=# 阅读全文
posted @ 2022-09-11 14:28 KINGBASE研究院 阅读(523) 评论(0) 推荐(0)
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 52 下一页