<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[rudy gao]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/jumewo</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; jumewo]]></copyright><item><title><![CDATA[搬家了]]></title><link>https://blog.csdn.net/jumewo/article/details/79838867</link><guid>https://blog.csdn.net/jumewo/article/details/79838867</guid><author>jumewo</author><pubDate>Sat, 07 Apr 2018 09:13:38 +0800</pubDate><description><![CDATA[我的博客即将入驻“云栖社区”，诚邀技术同仁一同入驻。]]></description><category></category></item><item><title><![CDATA[mongodb 2.4升级至3.2]]></title><link>https://blog.csdn.net/jumewo/article/details/51480473</link><guid>https://blog.csdn.net/jumewo/article/details/51480473</guid><author>jumewo</author><pubDate>Mon, 23 May 2016 11:44:38 +0800</pubDate><description><![CDATA[--mongorestore升级过程中如果遇到如下错误，需要删除admin数据库
[root@beta tmp]# mongorestore -h 127.0.0.1 --oplogReplay --port 27015 --dir /tmp/dump20160411/
2016-04-11T16:36:14.026+0800    building a list of dbs and colle]]></description><category></category></item><item><title><![CDATA[pg_upgrade 版本升级]]></title><link>https://blog.csdn.net/jumewo/article/details/51479211</link><guid>https://blog.csdn.net/jumewo/article/details/51479211</guid><author>jumewo</author><pubDate>Mon, 23 May 2016 09:35:38 +0800</pubDate><description><![CDATA[--对于小版本的升级，内部存储格式是兼容的，大版本不一定兼容
--小版本可以直接替换二进制文件，大版本需要导出与导入升级
Minor releases never change the internal storage format and are always compatible with earlier and later minor releases of the same major v]]></description><category></category></item><item><title><![CDATA[nulls first & nulls last 对索引影响]]></title><link>https://blog.csdn.net/jumewo/article/details/51314534</link><guid>https://blog.csdn.net/jumewo/article/details/51314534</guid><author>jumewo</author><pubDate>Wed, 04 May 2016 14:18:10 +0800</pubDate><description><![CDATA[-- 当我们需要排序字段时，比如order by name,如果name字段定义时没有not null时，就有可能涉及到null值的排序
-- 如果不注意，可能会造成隐藏的bug，pg默认null是无穷大，在升序时排在最后面，当然在排序时也可以指定 nulls first 或 nulls last
-- 具体使用方法在此不在复述，本文主要是讲的是在创建索引时指定 nulls first 或 nul]]></description><category></category></item><item><title><![CDATA[postgresql 9.5版本之前实现upsert功能]]></title><link>https://blog.csdn.net/jumewo/article/details/51281719</link><guid>https://blog.csdn.net/jumewo/article/details/51281719</guid><author>jumewo</author><pubDate>Fri, 29 Apr 2016 14:39:43 +0800</pubDate><description><![CDATA[最近有开发人员问，有没有办法实现在pg9.5版本之前实现upsert功能，现整理如下

--创建测试表，注意此处先不要主键或唯一约束
create table t2 (id int,name varchar(100));


-- pg 在9.5之前实现不存在则插入
-- 现在需要实现，当id字段的值存在时，则更新name字段的值，如果id字段的值不存在，则执行插入
with upsert as ]]></description><category></category></item><item><title><![CDATA[通过函数定位DML锁等待]]></title><link>https://blog.csdn.net/jumewo/article/details/50980251</link><guid>https://blog.csdn.net/jumewo/article/details/50980251</guid><author>jumewo</author><pubDate>Fri, 25 Mar 2016 15:08:35 +0800</pubDate><description><![CDATA[--创建函数，注意此函数只能定位由于dml操作所引起的锁等待，对于ddl引起的锁等待，此sql无法完全定位

CREATE OR REPLACE FUNCTION report_lock(refcursor, refcursor)
  RETURNS SETOF refcursor AS
$BODY$
declare
v_activity_count integer;
v_cur_relation]]></description><category></category></item><item><title><![CDATA[postgresql 正则暗坑]]></title><link>https://blog.csdn.net/jumewo/article/details/50953496</link><guid>https://blog.csdn.net/jumewo/article/details/50953496</guid><author>jumewo</author><pubDate>Tue, 22 Mar 2016 11:20:46 +0800</pubDate><description><![CDATA[--注意pg的正则使用不正会有隐患
 postgres=# select * from t;
 id | name 
----+------
  1 | bill
  1 | bill
  1 | bill
(3 rows)
--注意，由于没有匹配正则，其执行了过滤操作（其是在select字段中，不细看还以为t表中没有数据呐）
postgres=# select t.*,regexp_matche]]></description><category></category></item><item><title><![CDATA[mysql memcached 初探]]></title><link>https://blog.csdn.net/jumewo/article/details/50912103</link><guid>https://blog.csdn.net/jumewo/article/details/50912103</guid><author>jumewo</author><pubDate>Thu, 17 Mar 2016 11:17:39 +0800</pubDate><description><![CDATA[--mysql 5.7 已经把memcache 与 innodb 结合在了一起
The InnoDB memcached plugin provides an integrated memcached daemon that can automatically store and retrieve data from InnoDB tables, turning the MySQL server ]]></description><category></category></item><item><title><![CDATA[postgresql 数组类型]]></title><link>https://blog.csdn.net/jumewo/article/details/50781280</link><guid>https://blog.csdn.net/jumewo/article/details/50781280</guid><author>jumewo</author><pubDate>Wed, 02 Mar 2016 16:54:04 +0800</pubDate><description><![CDATA[--pg支持数组，且支持分片访问，比如[1:2],任意只有一个数字（没有冒号）的维数是从 1 开始到声明的数字为止的
 --如果任意维数被写为一个片段，也就是，包含一个冒号，那么所有维数都被当做是片段
If any dimension is written as a slice, i.e., contains a colon, then all dimensions are treated as ]]></description><category></category></item><item><title><![CDATA[mongo2.4_point_in_time_recovery]]></title><link>https://blog.csdn.net/jumewo/article/details/50772304</link><guid>https://blog.csdn.net/jumewo/article/details/50772304</guid><author>jumewo</author><pubDate>Tue, 01 Mar 2016 14:27:51 +0800</pubDate><description><![CDATA[--配置复制集
/opt/mongodb/2.4/bin/mongod --replSet=rs1 --journal --port 27018 --dbpath=/data/mongodb/27018 --logpath=/data/mongodb/log/27018/mongo.log --fork --logappend
/opt/mongodb/2.4/bin/mongod --replS]]></description><category></category></item><item><title><![CDATA[postgresql 定时收集表和索引统计信息]]></title><link>https://blog.csdn.net/jumewo/article/details/50747358</link><guid>https://blog.csdn.net/jumewo/article/details/50747358</guid><author>jumewo</author><pubDate>Fri, 26 Feb 2016 09:33:41 +0800</pubDate><description><![CDATA[--由于pg中表和索引的信息收集都是基于时间点的，对于以往的信息无法与现在的信息进行对比，故写下此工具进行统计信息收集

--创建数据信息的schema
create schema db_stat;
--创建收集信息的基础表
create table db_stat.snapshot_pg_stat_all_indexes
(relid int,indexrelid int,schemaname ]]></description><category></category></item><item><title><![CDATA[rsync增量重置备库]]></title><link>https://blog.csdn.net/jumewo/article/details/50699428</link><guid>https://blog.csdn.net/jumewo/article/details/50699428</guid><author>jumewo</author><pubDate>Fri, 19 Feb 2016 17:24:00 +0800</pubDate><description><![CDATA[--在主从复制环境中，如果从库不小心打开了读写模式（相当单节点的一个数据），比如
touch /usr/local/postgresql/9.3.4/5434/pgsql.recovery.trigger
--此时从节点已经于主机点脱离，此时再把这个节点改为从节点时，由于从的timeline高于主，故该节点不能再变成从节点了
[postgres@rudy_01 5434]$ ls | gre]]></description><category></category></item><item><title><![CDATA[Mongodb Wiredtiger存储引擎实现原理]]></title><link>https://blog.csdn.net/jumewo/article/details/50674416</link><guid>https://blog.csdn.net/jumewo/article/details/50674416</guid><author>jumewo</author><pubDate>Tue, 16 Feb 2016 14:05:36 +0800</pubDate><description><![CDATA[按照Mongodb默认的配置，￼WiredTiger的写操作会先写入Cache，并持久化到WAL(Write ahead log)，每60s或log文件达到2GB时会做一次Checkpoint，将当前的数据持久化，产生一个新的快照。Wiredtiger连接初始化时，首先将数据恢复至最新的快照状态，然后根据WAL恢复数据，以保证存储可靠性。


Wiredtiger的Cache采用Btree的]]></description><category></category></item><item><title><![CDATA[postgresql 时区与时间函数]]></title><link>https://blog.csdn.net/jumewo/article/details/50628540</link><guid>https://blog.csdn.net/jumewo/article/details/50628540</guid><author>jumewo</author><pubDate>Wed, 03 Feb 2016 11:15:18 +0800</pubDate><description><![CDATA[--把时间戳转成epoch值
postgres=# select extract(epoch from now());
    date_part     
------------------
 1447898857.74524
(1 row)


--把epoch 值转换回时间戳
postgres=# SELECT TIMESTAMP WITH TIME ZONE 'epoch' +  144]]></description><category></category></item><item><title><![CDATA[mysql 时区与时间函数]]></title><link>https://blog.csdn.net/jumewo/article/details/50628526</link><guid>https://blog.csdn.net/jumewo/article/details/50628526</guid><author>jumewo</author><pubDate>Wed, 03 Feb 2016 11:13:26 +0800</pubDate><description><![CDATA[--在mysql中可以直接使用sleep()函数,sysdate函数返回的是执行到当前函数的时间,而now函数返回的是执行sql的时间
mysql> SELECT now(),SYSDATE(), SLEEP(2),now(), sysdate() from dual;
+---------------------+---------------------+----------+--------]]></description><category></category></item><item><title><![CDATA[mysql binlog_format 适时修改]]></title><link>https://blog.csdn.net/jumewo/article/details/50619130</link><guid>https://blog.csdn.net/jumewo/article/details/50619130</guid><author>jumewo</author><pubDate>Mon, 01 Feb 2016 16:06:59 +0800</pubDate><description><![CDATA[--mysql允许在session或者global级别动态设置binlog_format的值，做在更新很多行时，可以设置 binlog_format = 'STATEMENT' 以加快数据应用到备库上
 A session that makes many small changes to the database might want to use row-based logging.
 A se]]></description><category></category></item><item><title><![CDATA[PgSQL · 特性分析 · PG主备流复制机制]]></title><link>https://blog.csdn.net/jumewo/article/details/50601693</link><guid>https://blog.csdn.net/jumewo/article/details/50601693</guid><author>jumewo</author><pubDate>Thu, 28 Jan 2016 16:41:06 +0800</pubDate><description><![CDATA[PostgreSQL在9.0之后引入了主备流复制机制，通过流复制，备库不断的从主库同步相应的数据，并在备库apply每个WAL record，这里的流复制每次传输单位是WAL日志的record。而PostgreSQL9.0之前提供的方法是主库写完一个WAL日志文件后，才把WAL日志文件传送到备库，这样的方式导致主备延迟特别大。同时PostgreSQL9.0之后提供了Hot Standby，备库在应]]></description><category></category></item><item><title><![CDATA[GPDB   · 特性分析· GreenPlum Primary/Mirror 同步机制]]></title><link>https://blog.csdn.net/jumewo/article/details/50601638</link><guid>https://blog.csdn.net/jumewo/article/details/50601638</guid><author>jumewo</author><pubDate>Thu, 28 Jan 2016 16:34:51 +0800</pubDate><description><![CDATA[PostgreSQL 主备同步机制是通过流复制实现，其原理见之前的月报PG主备流复制机制。
Greenplum 是基于PostgreSQL开发的，它的主备也是通过流复制实现，但是Segment节点中的Primary和Mirror之间的数据同步是基于文件级别的同步实现的。为什么Primary和Mirror不能再使用流复制实现呢？主要有两个原因:

Append Only表不写WAL日志，所以A]]></description><category></category></item><item><title><![CDATA[postgresql 聚合的暗坑]]></title><link>https://blog.csdn.net/jumewo/article/details/50594330</link><guid>https://blog.csdn.net/jumewo/article/details/50594330</guid><author>jumewo</author><pubDate>Wed, 27 Jan 2016 14:51:58 +0800</pubDate><description><![CDATA[--对于聚合操作，pg约束是不严格的，比如如下sql中，group by 缺少 name，但也能执行
postgres=# select id,name ,count(*) from t group by id;
 id | name | count 
----+------+-------
  1 | bcd  |     1
  2 | abc  |     1
  
  
--现模拟如下  ]]></description><category></category></item><item><title><![CDATA[mysql sql_mode 汇总整理]]></title><link>https://blog.csdn.net/jumewo/article/details/50588211</link><guid>https://blog.csdn.net/jumewo/article/details/50588211</guid><author>jumewo</author><pubDate>Tue, 26 Jan 2016 16:29:06 +0800</pubDate><description><![CDATA[-- ANSI 使sql符合标准sql
This mode changes syntax and behavior to conform more closely to standard SQL


-- STRICT_TRANS_TABLES 如果事务语句有错，则使事务失败
If a value could not be inserted as given into a transactiona]]></description><category></category></item></channel></rss>