Skip to content

Commit ed18546

Browse files
committed
new doc
1 parent 0a29518 commit ed18546

File tree

5 files changed

+335
-0
lines changed

5 files changed

+335
-0
lines changed

202404/20240401_01.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
## PostgreSQL 17 preview - 频繁提交table access method相关patch, undo-based table access methods真的快来了吗?
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2024-04-01
8+
9+
### 标签
10+
PostgreSQL , PolarDB , DuckDB , undo-based table access methods
11+
12+
----
13+
14+
## 背景
15+
16+
undo-based table access methods真的快来了吗? PostgreSQL 17频繁提交table access method相关功能增强patch.
17+
18+
[《PostgreSQL 17 preview - 支持修改分区表access method》](../202403/20240326_04.md)
19+
20+
[《PostgreSQL 17 preview - 寻找undo-based table access methods的蛛丝马迹》](../202403/20240326_03.md)
21+
22+
table AM 增加自定义分析采样接口, 原因是原来的接口仅仅适合heap表架构, 索引组织表的采样方法显然不同.
23+
24+
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=27bc1772fc814946918a5ac8ccb9b5c5ad0380aa
25+
```
26+
Generalize relation analyze in table AM interface
27+
author Alexander Korotkov <[email protected]>
28+
Sat, 30 Mar 2024 20:34:04 +0000 (22:34 +0200)
29+
committer Alexander Korotkov <[email protected]>
30+
Sat, 30 Mar 2024 20:34:04 +0000 (22:34 +0200)
31+
commit 27bc1772fc814946918a5ac8ccb9b5c5ad0380aa
32+
tree beb4fac8dfb2756c86f3ac13ec21d72f69daa55c tree
33+
parent b154d8a6d0e52e5f6b09739639fdf55fa88bc6b8 commit | diff
34+
Generalize relation analyze in table AM interface
35+
36+
Currently, there is just one algorithm for sampling tuples from a table written
37+
in acquire_sample_rows(). Custom table AM can just redefine the way to get the
38+
next block/tuple by implementing scan_analyze_next_block() and
39+
scan_analyze_next_tuple() API functions.
40+
41+
This approach doesn't seem general enough. For instance, it's unclear how to
42+
sample this way index-organized tables. This commit allows table AM to
43+
encapsulate the whole sampling algorithm (currently implemented in
44+
acquire_sample_rows()) into the relation_analyze() API function.
45+
46+
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com
47+
Reviewed-by: Pavel Borisov, Matthias van de Meent
48+
```
49+
50+
table AM 增加支持reloptions接口.
51+
52+
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=c95c25f9af4bc77f2f66a587735c50da08c12b37
53+
```
54+
Custom reloptions for table AM
55+
author Alexander Korotkov <[email protected]>
56+
Sat, 30 Mar 2024 20:36:25 +0000 (22:36 +0200)
57+
committer Alexander Korotkov <[email protected]>
58+
Sat, 30 Mar 2024 20:36:25 +0000 (22:36 +0200)
59+
commit c95c25f9af4bc77f2f66a587735c50da08c12b37
60+
tree 3f6f97b2ea2acf3de72b953e17ade6f5bc23db6e tree
61+
parent 27bc1772fc814946918a5ac8ccb9b5c5ad0380aa commit | diff
62+
Custom reloptions for table AM
63+
64+
Let table AM define custom reloptions for its tables. This allows to
65+
specify AM-specific parameters by WITH clause when creating a table.
66+
67+
The code may use some parts from prior work by Hao Wu.
68+
69+
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com
70+
Discussion: https://postgr.es/m/AMUA1wBBBxfc3tKRLLdU64rb.1.1683276279979.Hmail.wuhao%40hashdata.cn
71+
Reviewed-by: Reviewed-by: Pavel Borisov, Matthias van de Meent
72+
```
73+
74+
table AM 支持接管Insert index的逻辑.
75+
76+
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b1484a3f1910bfd0e254afe40085dfc3351bda8c
77+
```
78+
Let table AM insertion methods control index insertion master github/master
79+
author Alexander Korotkov <[email protected]>
80+
Sat, 30 Mar 2024 20:39:03 +0000 (22:39 +0200)
81+
committer Alexander Korotkov <[email protected]>
82+
Sat, 30 Mar 2024 20:53:56 +0000 (22:53 +0200)
83+
commit b1484a3f1910bfd0e254afe40085dfc3351bda8c
84+
tree 329e9e84dba07d2b85487c4acb5ebb975836947b tree
85+
parent c95c25f9af4bc77f2f66a587735c50da08c12b37 commit | diff
86+
Let table AM insertion methods control index insertion
87+
88+
Previously, the executor did index insert unconditionally after calling
89+
table AM interface methods tuple_insert() and multi_insert(). This commit
90+
introduces the new parameter insert_indexes for these two methods. Setting
91+
'*insert_indexes' to true saves the current logic. Setting it to false
92+
indicates that table AM cares about index inserts itself and doesn't want the
93+
caller to do that.
94+
95+
Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com
96+
Reviewed-by: Pavel Borisov, Matthias van de Meent, Mark Dilger
97+
```
98+
99+
100+
#### [期望 PostgreSQL|开源PolarDB 增加什么功能?](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
101+
102+
103+
#### [PolarDB 开源数据库](https://openpolardb.com/home "57258f76c37864c6e6d23383d05714ea")
104+
105+
106+
#### [PolarDB 学习图谱](https://www.aliyun.com/database/openpolardb/activity "8642f60e04ed0c814bf9cb9677976bd4")
107+
108+
109+
#### [购买PolarDB云服务折扣活动进行中, 55元起](https://www.aliyun.com/activity/new/polardb-yunparter?userCode=bsb3t4al "e0495c413bedacabb75ff1e880be465a")
110+
111+
112+
#### [PostgreSQL 解决方案集合](../201706/20170601_02.md "40cff096e9ed7122c512b35d8561d9c8")
113+
114+
115+
#### [德哥 / digoal's Github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
116+
117+
118+
#### [About 德哥](https://github.com/digoal/blog/blob/master/me/readme.md "a37735981e7704886ffd590565582dd0")
119+
120+
121+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
122+

202404/20240401_02.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
## PostgreSQL 17 preview - Add support for `MERGE ... WHEN NOT MATCHED BY SOURCE`
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2024-04-01
8+
9+
### 标签
10+
PostgreSQL , PolarDB , DuckDB , `MERGE ... WHEN NOT MATCHED BY SOURCE`
11+
12+
----
13+
14+
## 背景
15+
Merge语法支持当目标表存在, 源端不存在的row的action.
16+
17+
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=0294df2f1f842dfb0eed79007b21016f486a3c6c
18+
```
19+
Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.
20+
author Dean Rasheed <[email protected]>
21+
Sat, 30 Mar 2024 10:00:26 +0000 (10:00 +0000)
22+
committer Dean Rasheed <[email protected]>
23+
Sat, 30 Mar 2024 10:00:26 +0000 (10:00 +0000)
24+
commit 0294df2f1f842dfb0eed79007b21016f486a3c6c
25+
tree d01da8c03b91a25a438f05dd7dccdb95d13f8f92 tree
26+
parent 46e5441fa536b89c1123f270fdfeeb72c320b901 commit | diff
27+
Add support for MERGE ... WHEN NOT MATCHED BY SOURCE.
28+
29+
This allows MERGE commands to include WHEN NOT MATCHED BY SOURCE
30+
actions, which operate on rows that exist in the target relation, but
31+
not in the data source. These actions can execute UPDATE, DELETE, or
32+
DO NOTHING sub-commands.
33+
34+
This is in contrast to already-supported WHEN NOT MATCHED actions,
35+
which operate on rows that exist in the data source, but not in the
36+
target relation. To make this distinction clearer, such actions may
37+
now be written as WHEN NOT MATCHED BY TARGET.
38+
39+
Writing WHEN NOT MATCHED without specifying BY SOURCE or BY TARGET is
40+
equivalent to writing WHEN NOT MATCHED BY TARGET.
41+
42+
Dean Rasheed, reviewed by Alvaro Herrera, Ted Yu and Vik Fearing.
43+
44+
Discussion: https://postgr.es/m/CAEZATCWqnKGc57Y_JanUBHQXNKcXd7r=0R4NEZUVwP+syRkWbA@mail.gmail.com
45+
```
46+
47+
```
48+
+ UPDATE set key = t.key + 1, val = t.val || ' updated by ' || s.val
49+
+ WHEN NOT MATCHED BY SOURCE THEN
50+
+ UPDATE set key = t.key + 1, val = t.val || ' source not matched by merge2a'
51+
+ RETURNING merge_action(), t.*;
52+
+
53+
+merge_action|key|val
54+
+------------+---+------------------------------------------------------
55+
+UPDATE | 3|setup1 updated by merge1 source not matched by merge2a
56+
+INSERT | 1|merge2a
57+
+(2 rows)
58+
```
59+
60+
61+
#### [期望 PostgreSQL|开源PolarDB 增加什么功能?](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
62+
63+
64+
#### [PolarDB 开源数据库](https://openpolardb.com/home "57258f76c37864c6e6d23383d05714ea")
65+
66+
67+
#### [PolarDB 学习图谱](https://www.aliyun.com/database/openpolardb/activity "8642f60e04ed0c814bf9cb9677976bd4")
68+
69+
70+
#### [购买PolarDB云服务折扣活动进行中, 55元起](https://www.aliyun.com/activity/new/polardb-yunparter?userCode=bsb3t4al "e0495c413bedacabb75ff1e880be465a")
71+
72+
73+
#### [PostgreSQL 解决方案集合](../201706/20170601_02.md "40cff096e9ed7122c512b35d8561d9c8")
74+
75+
76+
#### [德哥 / digoal's Github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
77+
78+
79+
#### [About 德哥](https://github.com/digoal/blog/blob/master/me/readme.md "a37735981e7704886ffd590565582dd0")
80+
81+
82+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
83+

202404/20240401_03.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
## PostgreSQL 17 preview - pg_basetype 获得domain类型的基本类型
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2024-04-01
8+
9+
### 标签
10+
PostgreSQL , PolarDB , DuckDB , domain , type , pg_basetype
11+
12+
----
13+
14+
## 背景
15+
通过domain可以定义一些基本类型的收敛类型, 例如合法的邮件地址、合法的年龄.
16+
17+
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b154d8a6d0e52e5f6b09739639fdf55fa88bc6b8
18+
```
19+
Add pg_basetype() function to extract a domain's base type.
20+
author Tom Lane <[email protected]>
21+
Sat, 30 Mar 2024 17:57:19 +0000 (13:57 -0400)
22+
committer Tom Lane <[email protected]>
23+
Sat, 30 Mar 2024 17:57:19 +0000 (13:57 -0400)
24+
commit b154d8a6d0e52e5f6b09739639fdf55fa88bc6b8
25+
tree fe758a1a6130bb68b0f3f93d05d1276ef0014a78 tree
26+
parent ecf741cfae0603d1df269d8b799455bbcaef86e7 commit | diff
27+
Add pg_basetype() function to extract a domain's base type.
28+
29+
This SQL-callable function behaves much like our internal utility
30+
function getBaseType(), except it returns NULL rather than failing for
31+
an invalid type OID. (That behavior is modeled on our experience with
32+
other catalog-inquiry functions such as the ACL checking functions.)
33+
The key advantage over doing a join to pg_type is that it will loop
34+
as needed to find the bottom base type of a nest of domains.
35+
36+
Steve Chavez, reviewed by jian he and others
37+
38+
Discussion: https://postgr.es/m/CAGRrpzZSX8j=MQcbCSEisFA=ic=K3bknVfnFjAv1diVJxFHJvg@mail.gmail.com
39+
```
40+
41+
[《PostgreSQL 邮箱email 类型 - domain》](../202001/20200106_02.md)
42+
43+
[《PostgreSQL 兼容MySQL year类型方法 - domain》](../202001/20200106_01.md)
44+
45+
[《PostgreSQL 兼容 MySQL tinyint , unsigned int , zerofill 等 - domain , lpad》](../202001/20200105_04.md)
46+
47+
邮件domain
48+
```
49+
postgres=# create domain email as text check(value ~ '.+@.+\..+');
50+
CREATE DOMAIN
51+
postgres=# select 'a'::email;
52+
ERROR: value for domain email violates check constraint "email_check"
53+
postgres=# select '[email protected]'::email;
54+
email
55+
----------------
56+
57+
(1 row)
58+
59+
postgres=# select '[email protected]'::email;
60+
email
61+
-------------------
62+
63+
(1 row)
64+
```
65+
66+
PostgreSQL 17增加pg_basetype函数, 获取domainl诶下的基本类型.
67+
```
68+
+-- Get the base type of a domain
69+
+--
70+
+create domain mytext as text;
71+
+create domain mytext_child_1 as mytext;
72+
+select pg_basetype('mytext'::regtype);
73+
+ pg_basetype
74+
+-------------
75+
+ text
76+
+(1 row)
77+
+
78+
+select pg_basetype('mytext_child_1'::regtype);
79+
+ pg_basetype
80+
+-------------
81+
+ text
82+
+(1 row)
83+
+
84+
+select pg_basetype(1); -- expect NULL not error
85+
+ pg_basetype
86+
+-------------
87+
+
88+
+(1 row)
89+
+
90+
+drop domain mytext cascade;
91+
+NOTICE: drop cascades to type mytext_child_1
92+
+--
93+
```
94+
95+
96+
97+
#### [期望 PostgreSQL|开源PolarDB 增加什么功能?](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
98+
99+
100+
#### [PolarDB 开源数据库](https://openpolardb.com/home "57258f76c37864c6e6d23383d05714ea")
101+
102+
103+
#### [PolarDB 学习图谱](https://www.aliyun.com/database/openpolardb/activity "8642f60e04ed0c814bf9cb9677976bd4")
104+
105+
106+
#### [购买PolarDB云服务折扣活动进行中, 55元起](https://www.aliyun.com/activity/new/polardb-yunparter?userCode=bsb3t4al "e0495c413bedacabb75ff1e880be465a")
107+
108+
109+
#### [PostgreSQL 解决方案集合](../201706/20170601_02.md "40cff096e9ed7122c512b35d8561d9c8")
110+
111+
112+
#### [德哥 / digoal's Github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
113+
114+
115+
#### [About 德哥](https://github.com/digoal/blog/blob/master/me/readme.md "a37735981e7704886ffd590565582dd0")
116+
117+
118+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
119+

202404/readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<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>
2+
3+
### 文章列表
4+
----
5+
##### 20240401_03.md [《PostgreSQL 17 preview - pg_basetype 获得domain类型的基本类型》](20240401_03.md)
6+
##### 20240401_02.md [《PostgreSQL 17 preview - Add support for `MERGE ... WHEN NOT MATCHED BY SOURCE`](20240401_02.md)
7+
##### 20240401_01.md [《PostgreSQL 17 preview - 频繁提交table access method相关patch, undo-based table access methods真的快来了吗?》](20240401_01.md)

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ digoal's|PostgreSQL|文章|归类
9898

9999
### 所有文档如下
100100
----
101+
##### 202404/20240401_03.md [《PostgreSQL 17 preview - pg_basetype 获得domain类型的基本类型》](202404/20240401_03.md)
102+
##### 202404/20240401_02.md [《PostgreSQL 17 preview - Add support for `MERGE ... WHEN NOT MATCHED BY SOURCE`》](202404/20240401_02.md)
103+
##### 202404/20240401_01.md [《PostgreSQL 17 preview - 频繁提交table access method相关patch, undo-based table access methods真的快来了吗?》](202404/20240401_01.md)
104+
----
101105
##### 202403/20240330_05.md [《用zig开发PostgreSQL插件》](202403/20240330_05.md)
102106
##### 202403/20240330_04.md [《PostgreSQL 17 preview - 支持在申请时指定动态共享内存区域初始、最大段size》](202403/20240330_04.md)
103107
##### 202403/20240330_03.md [《PostgreSQL 17 preview - 跟踪slot断联时间戳`pg_replication_slots.inactive_since`》](202403/20240330_03.md)

0 commit comments

Comments
 (0)