Skip to content

Commit d6c5d55

Browse files
committed
new doc
1 parent dc67421 commit d6c5d55

File tree

6 files changed

+53
-3
lines changed

6 files changed

+53
-3
lines changed

201908/20190803_04.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## PostgreSQL PostGIS 3 st_asgeojson
1+
## PostgreSQL PostGIS 3 ST_AsGeoJSON(record) - early only ST_AsGeoJSON(geo)
22
33
### 作者
44
digoal

201908/20190804_01.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
## PostgreSQL pgpool-ii 4.x 支持从standby读relcache - relcache_query_target = load_balance_node
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2019-08-04
8+
9+
### 标签
10+
PostgreSQL , pgpool , relcache_query_target = load_balance_node , 从standby读relcache
11+
12+
----
13+
14+
## 背景
15+
一个有跨region业务的企业,可能存在这样的数据库复制架构,主库(总部)在region a,而从库(分公司)在region b。主库读写,从库(分公司)大多数是读,写操作较少。
16+
17+
又或者使用跨region的dr(数据库容灾),从库大多数是读,写操作较少。
18+
19+
如果在分公司(从库)部分使用pgpool来连接,会出现什么问题呢?
20+
21+
![pic](20190804_01_pic_001.png)
22+
23+
虽然在分公司的用户对从库的读很多,对主库的写很少,但是在pgpool 4.1的版本以前,relcache还是需要从主库读取的,所以这种跨region的读写分离,即使读的都是本地库,但是主库在远端的时候,性能依旧不好。
24+
25+
pgpool 4.1开始,引入了一个新的配置relcache_query_target,同时将backend weight of primary server 设置为 0即可:
26+
27+
From Pgpool-II 4.1, which is under development, user could eliminate the slow system catalog access in from region B to region A by setting relcache_query_target = load_balance_node and backend weight of primary server to 0 in Pgpool-II running in region B.
28+
29+
如图:
30+
31+
![pic](20190804_01_pic_002.png)
32+
33+
需要注意的是,如果主库的ddl非常多,而从库延迟较大时,可能会有问题。因为从库的ddl还不是最新的。这种配置比较适合于ddl较少,或者从库不会读取主库新建的表(或者修改过结构的对象)对情况。
34+
35+
Please note that , however, there may be replication delay and that could cause a trouble if the target table is pretty new because the system catalog in the standby server may not the have the new table info. So this configuration is best suitable for a system the table creation is rare, or they are created while users do not access the system.
36+
37+
## 参考
38+
http://pgsqlpgpool.blogspot.com/2019/07/when-primary-server-is-far-away-from.html
39+
40+
41+
<a rel="nofollow" href="http://info.flagcounter.com/h9V1" ><img src="http://s03.flagcounter.com/count/h9V1/bg_FFFFFF/txt_000000/border_CCCCCC/columns_2/maxflags_12/viewers_0/labels_0/pageviews_0/flags_0/" alt="Flag Counter" border="0" ></a>
42+
43+
44+
## [digoal's 大量PostgreSQL文章入口](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
45+
46+
47+
## [免费领取阿里云RDS PostgreSQL实例、ECS虚拟机](https://free.aliyun.com/ "57258f76c37864c6e6d23383d05714ea")
48+

201908/20190804_01_pic_001.png

58.2 KB
Loading

201908/20190804_01_pic_002.png

48.5 KB
Loading

201908/readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
### 文章列表
44
----
5-
##### 20190803_04.md [《PostgreSQL PostGIS 3 st_asgeojson》](20190803_04.md)
5+
##### 20190804_01.md [《PostgreSQL pgpool-ii 4.x 支持从standby读relcache - relcache_query_target = load_balance_node》](20190804_01.md)
6+
##### 20190803_04.md [《PostgreSQL PostGIS 3 ST_AsGeoJSON(record) - early only ST_AsGeoJSON(geo)》](20190803_04.md)
67
##### 20190803_03.md [《PostgreSQL PostGIS 3 Hilbert Geometry Sorting - 空间排序算法优化》](20190803_03.md)
78
##### 20190803_02.md [《PostgreSQL PostGIS overlap》](20190803_02.md)
89
##### 20190803_01.md [《PostgreSQL PostGIS ST_AsMVT Performance 提升 - SQL提取地图矢量瓦片(Mapbox Vector Tile)》](20190803_01.md)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ digoal's|PostgreSQL|文章|归类
5454

5555
### 所有文档如下
5656
----
57-
##### 201908/20190803_04.md [《PostgreSQL PostGIS 3 st_asgeojson》](201908/20190803_04.md)
57+
##### 201908/20190804_01.md [《PostgreSQL pgpool-ii 4.x 支持从standby读relcache - relcache_query_target = load_balance_node》](201908/20190804_01.md)
58+
##### 201908/20190803_04.md [《PostgreSQL PostGIS 3 ST_AsGeoJSON(record) - early only ST_AsGeoJSON(geo)》](201908/20190803_04.md)
5859
##### 201908/20190803_03.md [《PostgreSQL PostGIS 3 Hilbert Geometry Sorting - 空间排序算法优化》](201908/20190803_03.md)
5960
##### 201908/20190803_02.md [《PostgreSQL PostGIS overlap》](201908/20190803_02.md)
6061
##### 201908/20190803_01.md [《PostgreSQL PostGIS ST_AsMVT Performance 提升 - SQL提取地图矢量瓦片(Mapbox Vector Tile)》](201908/20190803_01.md)

0 commit comments

Comments
 (0)