
postgresql
bielidefeng
这个作者很懒,什么都没留下…
展开
-
Row and Array Comparisons
http://www.postgresql.org/docs/9.3/static/functions-comparisons.html#AEN18448Row-wise Comparison: row的定义:http://www.postgresql.org/docs/9.3/static/sql-expressions.html#SQL-SYNTAX-ROW-CONSTRUCTORS row与原创 2014-05-30 10:34:35 · 826 阅读 · 0 评论 -
cursor
http://blog.163.com/digoal@126/blog/static/163877040201111694355822/http://blog.163.com/digoal@126/blog/static/1638770402012520105855757/游标使用注意点:http://www.postgresql.org/docs/9.3/static/sql-declare.h原创 2014-05-30 10:34:19 · 892 阅读 · 0 评论 -
pgpool连接池
max_pool,num_init_children : 通过pgpool连接进数据库的个数不能超过 num_init_children * max_pool 个connection_life_time: 缓存的连接的过期时长。(超过num_init_children * max_pool后在一定空闲时间内需要释放的连接)reset_query_list : 退出一个session时发送给后台的命原创 2014-05-30 10:34:11 · 3087 阅读 · 0 评论 -
pgpool流复制&failover故障切换
参看:http://blog.163.com/czg_e/blog/static/461045612012129105020629/http://pgpool.projects.pgfoundry.org/pgpool-II/doc/pgpool-zh_cn.html#connection_pool_modehttp://dz.sdut.edu.cn/blog/subaochen/?p=430同一原创 2014-05-30 10:34:09 · 5659 阅读 · 0 评论 -
流复制
postgresql 流复制:http://francs3.blog.163.com/blog/static/4057672720136210240967/master(127.0.0.1:5432): 数据目录:/home/pg93/test_rep/data initdb -D $PGDATA -E UTF8 --locale=C -U postgres -W 修改pg_hba.conf原创 2014-05-30 10:34:07 · 907 阅读 · 0 评论 -
page描述(待续)
page:是对block的描述,该如何存储8K数据。以下是Page的结构:http://blog.chinaunix.net/uid-24774106-id-3764606.html查看page:http://www.postgresql.org/docs/9.2/static/pageinspect.htmlcreate extension pageinspect;http://blog.163原创 2014-05-30 10:33:52 · 688 阅读 · 0 评论 -
table相关信息
http://blog.163.com/digoal@126/blog/static/1638770402013527920474/create extension pgstattuple;create extension pg_freespacemap; 查看表文件路径select * from pg_relation_filepath('re');查看表(所有page)的大小select *原创 2014-05-30 10:33:55 · 593 阅读 · 0 评论 -
mvcc
http://my.oschina.net/Kenyon/blog/108850update tuple时会新增一个tuple然后将其隐藏。delete tuple时会隐藏tuple。postgres=# truncate table mmpostgres-# ;TRUNCATE TABLEpostgres=# insert into mm values(1999);INSERT 0 1postg原创 2014-05-30 10:33:59 · 579 阅读 · 0 评论 -
备份恢复
postgresql利用归档文件恢复:http://bbs.chinaunix.net/thread-1771360-1-1.html http://blog.163.com/digoal@126/blog/static/16387704020110442050808/ master:ip:127.0.0.1,port:1921,数据目录:$PGDATA=/home/pg93/pg_root原创 2014-05-30 10:34:04 · 646 阅读 · 0 评论 -
继承
继承: http://www.postgresql.org/docs/9.3/static/ddl-inherit.html分区表: http://www.postgresql.org/docs/9.3/static/ddl-partitioning.html 分区表需要和trigger一起使用才可。CREATE TABLE measurement ( city_id int原创 2014-05-30 10:34:30 · 625 阅读 · 0 评论 -
xlog
http://blog.163.com/digoal@126/blog/static/1638770402014395222222/pg_current_xlog_insert_location函数: 指的是写入wal buffer的位置pg_current_xlog_location函数: 指的是已经fsync(异步)到wal文件的位置(参数synchronous_commit = off)。原创 2014-05-30 10:34:14 · 743 阅读 · 0 评论 -
postgresql.conf 部分参数说明
checkpoint参数描述:checkpoint的时候会将所有的脏数据都flush到磁盘上checkpoint_timeout: 两次checkpoint间隔时长checkpoint_segments: 两次checkpoint间隔最大的xlog日志文件数量(指的是pg_xlog下的文件:000000010000000000000007)以日志文件段(每个段通常 16 兆大)计。walwrite原创 2014-05-30 10:33:50 · 6078 阅读 · 0 评论 -
bind变量
http://www.postgresql.org/docs/9.3/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-DIAGNOSTICSEXECUTE format('UPDATE tbl SET %I = $1 WHERE key = $2', colname) USING newvalue, keyvalue;原创 2014-05-30 10:34:21 · 691 阅读 · 0 评论 -
pg进程
bgwriter:http://book.51cto.com/art/201201/313208.htmautovacuum:http://book.51cto.com/art/201201/313211.htmhttp://www.postgresql.org/docs/9.2/static/routine-vacuuming.html#AUTOVACUUMwalwriter:http://bo原创 2014-05-30 10:33:57 · 675 阅读 · 0 评论 -
ubuntu2
ubuntu追加空间http://blog.youkuaiyun.com/openme_openwrt/article/details/8099956-------------------播放视频avi等使用SMPLAYER播放器-----------终端目录的说明使用“/usr/.....”===>系统目录使用“~/桌面/...”===原创 2014-05-30 11:05:16 · 1793 阅读 · 0 评论 -
执行计划
http://blog.youkuaiyun.com/tianlianchao1982/article/details/11557099转载 2014-05-30 17:33:15 · 811 阅读 · 0 评论 -
idx
btree & hash索引: http://www.kankanews.com/ICkengine/archives/127746.shtml http://blog.youkuaiyun.com/tonyxf121/article/details/7976824 http://www.uml.org.cn/sjjm/201107145.asporder by : 会使用索引(如果有索引) 对于limit.原创 2014-05-30 10:34:16 · 818 阅读 · 0 评论 -
System Administration Functions
http://www.postgresql.org/docs/9.3/static/functions-admin.htmlGeneric File Access Functions: 普通文件的访问方法:digoal=# select pg_ls_dir('.'); pg_ls_dir ----------------- pg_multixact pg_notify postmast原创 2014-05-30 10:34:33 · 881 阅读 · 0 评论 -
tablefunc 行转列
http://www.postgresql.org/docs/9.3/static/tablefunc.html安装extension tablefunc :digoal=# create extension tablefunc ;CREATE EXTENSIONnormal_rand: normal_rand(int numvals, float8 mean, float8 stddev) r原创 2014-05-30 10:34:49 · 1573 阅读 · 0 评论 -
recovery PITR 即时恢复
http://blog.163.com/digoal@126/blog/static/16387704020131410250983/http://www.cnblogs.com/gaojian/archive/2013/08/07/3243045.html原创 2014-05-30 10:34:52 · 2275 阅读 · 0 评论 -
聚合
http://www.postgresql.org/docs/9.3/static/functions-aggregate.html array_agg: 聚合函数,返回一个array,相当于oracle的wm_concat:digoal=# select array_agg(fooid) from foo; array_agg ----------------- {4,5,7,6,1原创 2014-05-30 10:34:45 · 712 阅读 · 0 评论 -
pgsql_fdw
http://my.oschina.net/Kenyon/blog/214953转载 2014-06-06 16:26:34 · 1154 阅读 · 0 评论 -
gdb调试postgresql(待续)
http://blog.youkuaiyun.com/bhq2010/article/details/12200533http://wiki.postgresql.org/wiki/Pgsrcstructure转载 2014-06-06 14:49:40 · 5434 阅读 · 0 评论 -
SQL
update/delete .. order by .. limit ..: update aa set b='mmmmmmmmbbbbbbbb' where a>10 order by a limit 1; 会报错:因为update 不能和order by 或limit 联合使用。如果需要使用则 需要打一个补丁:http://blog.163.com/digoal@126/blog/stat原创 2014-05-30 10:34:23 · 2918 阅读 · 0 评论 -
统计系统性能
http://docs.oracle.com/cd/E19253-01/819-6951/index.htmlhttp://lovesoo.org/linux-sar-command-detailed.htmlhttp://www.live-in.org/archives/922.htmlfree:http://zhidao.baidu.com/link?url=KSkrfQTN0EsYj5coo原创 2014-05-30 10:34:02 · 789 阅读 · 0 评论 -
pgfincore使用posix_fadvise缓存os cache
http://blog.163.com/digoal@126/blog/static/163877040201062944945126/转载 2014-06-09 14:16:24 · 1774 阅读 · 0 评论 -
create type/cast/ENUM
create type:http://www.postgresql.org/docs/9.3/static/sql-createtype.html enum:http://www.postgresql.org/docs/9.3/static/datatype-enum.html,http://www.postgresql.org/docs/9.3/static/functions-enum.htm原创 2014-05-30 10:34:47 · 873 阅读 · 0 评论 -
ALTER TABLE rewrites
alter一个表的列的时候会出现rewrites表: 比如添加一个有默认值的新列会rewrites重写表(即先vacuum full此表):http://my.oschina.net/Kenyon/blog/99757 ctid来查看有默认值的新列:digoal=# select ctid,* from foo; ctid | fooid | foosubi原创 2014-05-30 10:34:38 · 700 阅读 · 0 评论 -
vacuum和vacuum full区别
1:vacuum full会lock table ,vacuum不会。2:vacuum只是将deadtuple的行的空间转换为能够使用的状态,vacuum full会将这些空间碎片后面的数据上移。http://www.postgresql.org/docs/9.2/static/routine-vacuuming.html#AUTOVACUUMhttp://www.cnblogs.com/dadu原创 2014-05-30 10:34:40 · 5209 阅读 · 0 评论 -
return setof
setof: 返回多行结果集:digoal=# CREATE TYPE compfoo AS (f1 int, f2 text);CREATE TYPEdigoal=# CREATE FUNCTION textst() RETURNS SETOF compfoo AS $$digoal$# SELECT fooid, fooname FROM foodigoal$# $$ LANGUAGE原创 2014-05-30 10:34:42 · 985 阅读 · 0 评论 -
parser切词&全文检索
全文检索:http://www.postgresql.org/docs/9.3/interactive/textsearch.htmlpostgres 切词: http://blog.163.com/digoal@126/blog/static/163877040201422410175698/ ts_parse:获取切词后的所有词组 SELECT * FROM ts_parse('zhpars原创 2014-05-30 10:34:26 · 1568 阅读 · 0 评论 -
centos2
----------ps -ewf显示所有进程,ps -a|grep ss指的是显示ss关键字的所有进程。top是动态显示进程。---------cat直接将文件内容显示在终端上。---------查看linux系统版本信息cat /etc/*release。---------从一台Linux机子拷贝recovery.conf.sample到192.168.59.128原创 2014-05-30 11:04:45 · 1222 阅读 · 0 评论 -
postgres-xc
Postgres-XC:http://blog.youkuaiyun.com/huguangshanse00/article/details/9636621http://blog.163.com/digoal@126/blog/static/1638770402013332335933/http://blog.163.com/digoal@126/blog/static/1638770402013310018转载 2014-05-30 10:34:28 · 4233 阅读 · 0 评论