摘要:一般大家都知道,delete操作可以引起表碎片问题。但引起表碎片的并不仅仅只有delete操作。这里将演示一下由insert操作引起的表碎片。 在MySQL中,有两种碎片: 1.表中的页是完全空闲的 2.表中的页没有被完全填充,还有部分空闲空间 有三种情况下,insert操作会导致表碎片: 1.带有 阅读全文
[Warning] InnoDB: Difficult to Find Free Blocks in the Buffer Pool
2020-11-24 09:59 by abce, 2929 阅读, 0 推荐, 收藏,
摘要:MySQL错误日志给出警告信息: [Warning] InnoDB: Difficult to find free blocks in the buffer pool (336 search iterations)! 0 failed attempts to flush a page! Consid 阅读全文
安全地关闭MySQL
2020-11-19 12:09 by abce, 553 阅读, 0 推荐, 收藏,
摘要:在关闭mysql server的时候,可能会由于关闭的方式而出现各种问题。下面的一些步骤,可以减少问题的发生。 1.停止复制 在一些特殊环境下,slave节点可能会尝试从错误的位置(position)进行启动。为了减少这种风险,要先停止io thread,从而不接收新的事件信息。 mysql> st 阅读全文
PostgreSQL中的孤儿文件(orphaned data files)
2020-11-18 08:28 by abce, 989 阅读, 0 推荐, 收藏,
摘要:创建一个测试表 postgres=# create table t1(a int); CREATE TABLE postgres=# select pg_relation_filepath('t1'); pg_relation_filepath base/75062/75297 (1 row) po 阅读全文
PostgreSQL的并行查询
2020-11-17 08:48 by abce, 7107 阅读, 0 推荐, 收藏,
摘要:PostgreSQL的并行化包含三个重要组件:进程本身(leader进程)、gather、workers。没有开启并行化的时候,进程自身处理所有的数据;一旦计划器决定某个查询或查询中部分可以使用并行的时候,就会在查询的并行化部分添加一个gather节点,将gather节点作为子查询树的根节点。 查询 阅读全文
PostgreSQL中对IN、EXISTS、ANY/ALL、JOIN的sql优化
2020-11-16 08:47 by abce, 4107 阅读, 0 推荐, 收藏,
摘要:测试环境: postgres=# select version(); version PostgreSQL 11.9 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39), 64-bit (1 阅读全文
PostgreSQL中enable、disable和validate外键约束
2020-11-14 09:22 by abce, 3936 阅读, 0 推荐, 收藏,
摘要:postgres=# create table t1(a int primary key,b text,c date); CREATE TABLE postgres=# create table t2(a int primary key,b int references t1(a),c text); 阅读全文
PostgreSQL中的collations
2020-11-13 09:08 by abce, 1133 阅读, 0 推荐, 收藏,
摘要:与Oracle相比,PostgreSQL对collation的支持依赖于操作系统。 以下是基于Centos7.5的测试结果 $ env | grep LC $ env | grep LANG LANG=en_US.UTF-8 使用initdb初始化集群的时候,就会使用这些操作系统的配置。 postg 阅读全文
windows下安装Python虚拟环境virtualenvwrapper-win
2020-11-12 08:33 by abce, 157 阅读, 0 推荐, 收藏,
摘要:1.使用pip进行安装pip install virtualenvwrapper-win 2.使用easy_install进行安装easy_install virtualenvwrapper-win 3.使用源码进行安装git clone git://github.com/davidmarble/v 阅读全文
PostgreSQL中的template0和template1库
2020-11-11 09:48 by abce, 2075 阅读, 2 推荐, 收藏,
摘要:postgresql中默认会有三个数据库:postgres、template0、template1。 postgres=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges + + + 阅读全文
浙公网安备 33010602011771号