Skip to content

Commit ff3bf1c

Browse files
committed
new doc
1 parent 1464fb5 commit ff3bf1c

File tree

8 files changed

+181
-5
lines changed

8 files changed

+181
-5
lines changed

202303/20230316_01.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ postgres=# select * from a;
120120
2、file_fdw实际上也是调用了copy来进行导入, 所以copy本质上也可以支持倒序读取.
121121

122122
3、insert into on conflict的bug, 实在是不应该, 都已经指定了顺序, 也指定了where过滤, 怎么还能给报多次更新的错呢.
123+
- 社区几位committer的回复是即使用户能保证插入顺序, 但是从产品设计的角度, 他们依旧要认定这里是需要抛出错误的. 这就太保守了吧, 保守到影响产品功能、用户体验了.
124+
- https://www.postgresql.org/message-id/flat/5a1545f3.1e8a.186ed6b8959.Coremail.digoal%40126.com#3365ce8af1e5e3b540b7f2c9b5f13834
123125

124126
4、file_fdw也太不强大了, 支持一下通配符, 或者支持多个文件配置, 多香啊. 用户体验立即上升100倍.
125127

202303/20230319_01.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ https://milvus.io/
3535

3636
https://github.com/milvus-io/milvus
3737

38+
更多, 支持向量搜索(Support Vector Search)是一种高效的近似最近邻搜索算法,能够在高维空间中快速找到最近的点。以下是一些开源的支持向量搜索列存储引擎:
39+
- Faiss:由Facebook开发的高性能相似度搜索库,支持GPU加速和多种相似度度量方式。
40+
- Annoy:基于C++的近似最近邻搜索库,支持多种距离度量方式,适用于大规模数据集。
41+
- NMSLIB:开源的高效相似度搜索库,支持多种距离度量方式和多种索引结构,可用于大规模数据集。
42+
- SPTAG:微软开发的高性能相似度搜索引擎,支持多种距离度量方式和多种索引结构,适用于大规模数据集。
43+
- Milvus:由Zilliz开发的开源向量相似度搜索引擎,支持多种距离度量方式和多种索引结构,适用于大规模数据集和分布式部署。
44+
3845
回到主角lance, 更多信息参考lance的github.
3946

4047
<div align="center">

202303/20230319_02.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ PostgreSQL pg-strom 是计算加速插件, 利用GPU的计算能力. 计算加
2121
pg-strom 贡献的pg2arrow插件可以将PG的数据转成arrow列存储文件. arrow_fdw则可以让PG通过外部表的接口读写arrow格式的列存储文件.
2222

2323
通过arrow的支持, 使得PG融入到了大数据生态中.
24+
25+
对比arrow和parquet:
26+
- https://arrow.apache.org/blog/2022/10/05/arrow-parquet-encoding-part-1/
27+
- https://arrow.apache.org/blog/2022/10/08/arrow-parquet-encoding-part-2/
28+
- https://arrow.apache.org/blog/2022/10/17/arrow-parquet-encoding-part-3/
2429

2530
## pg2arrow
2631
https://github.com/heterodb/pg2arrow

202303/20230319_05.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ OKR 是企业常用的 “定目标 定策略 跟踪执行过程” 的管理工
2929
- [《德说-第208期, 如何与 ChatGPT代表的AI 合作?》](../202303/20230317_01.md)
3030

3131
### okr 方法论实施步骤
32+
![pic](20230319_05_pic_001.jpg)
3233

3334
1、结果/大方向
3435
- 大O的明确叙述?
3536
- 类似使命愿景价值观的东西。
3637

37-
2、正名/原则(出现战略分歧时, 用什么东西来进行决断)
38+
2、正名/原则/契机/师出有名/微言大义 (出现战略分歧时, 用什么东西来进行决断)
3839
- 就是为什么要设置这样的大O?
39-
- 这个大O带来的社会价值,公司价值,个人价值等。
40+
- 这个大O带来的用户价值、产业链价值、国家价值、公司价值,个人价值等。
4041

4142
3、定位, 为什么是你来做?
4243
- 这个事情的参与方有哪些, 各自优势, 各自供需. (供需连)
@@ -62,7 +63,11 @@ OKR 是企业常用的 “定目标 定策略 跟踪执行过程” 的管理工
6263
- KR就是O的充分必要条件。
6364

6465
8、要投入什么。
65-
- 需要投入什么资源,人力,横行团队的保障等。
66+
- 需要投入什么资源,人力,横向团队的保障等。
67+
68+
9、风险是什么?
69+
70+
10、风险应对预案是什么?
6671

6772

6873
### okr 动态规划 & 可观测
@@ -78,6 +83,14 @@ OKR 是企业常用的 “定目标 定策略 跟踪执行过程” 的管理工
7883
- 建立可观测体系(定义埋点、关系、采集数据、分析、可视化等), 支持定期的复盘,类似优化器的动态规划:
7984
- 实际做了什么, 预期目标是什么, 观测到的实际结果是什么,原因分析,用以修正下一步的策略。
8085

86+
## 例子
87+
```
88+
copy (
89+
select
90+
pgp_sym_decrypt($_$\xc30d04090302389edbafa4c1650afdd2c556015514106c714e74607d41b17a5de4ec099add7fb4bd2e3bd2d234b82efe088ad1193b75459ccc6e72202ca558e4067a4c2f7cca0f7ef612990df02ea6af3ef1e1f996321dc3659a80a64b0157eb3a49afa3ee94998b6bc318709c5a3a93365f69f108261c944c30f4f19122884448035ae8e11f7a66a9065de2a4a2358e6da999214cd48b1f0042bc447192e9fb5b10d2d6adae9977a7cdfee593d2ca12c8cafe664c3a864e6f517c67fbe757760b5737539fe653b422f5b11f6fca5f8e7d29e3905f03c7b59bbebc162addbec295b530ca93cb5f7543322b7bd6404477246a26a59e8d257eabfd0c78c3d1a879fcc50a207473f1e7a8a60e538706173c189e9c43716f8edd2217a298ec1b890a21461f918fef9d41b918ebc1c4c066b8cbf0e35adf36daf8de5503266c5c68ce328e15bd5eaddf7d795450aea64d0f0316b6abd046dd56b8eddb288f747aef125c3373887cb59a05332c2c5311d26b77d39fdd7801add607e900bb4bf2ac635391a59648d70f1b6d618ba3aeb12ce820a0f94c37d8ee07a1327757c2d2eb9f0a72270cb7db6489e179c1660b0f98bf1a1c2a440872f33c115e1bc9f82d15fb1488c337fa5743fd4dfb5a59ae89fc03f8f1745b3e77fb31c1d15c618d6a906dbe92ba4c2e01f5f6061593a9cb45375bfcd55332bd41301d75cea7f5d3cbe307d4ec2bffa5870a55c722cedf233c056d303c4dccd9871ebbd3ea591c7c47e23550b3ee204d450173f11a7c6282b82f524dc7eac42c667820949a8d93461e09723c1000da8cab65858c05a1accdab8246f8ff5dd9b2a035401194b1a4343037d5ac300891b06622882a2d27adf81ec79e748d6379aae270aa8ed872ae220a93f2b40f0e432ac8516cc7db82b90bb5ab4aa8e9f0e7b3862fcf87b5c0380e6a55e549fbcea349d0b69597d403fed70d3b5275c052adcab5e542377f6f79c780ae61a1ebb1403a4ee648f269b0e53aeb3be232b27b045f2c61abc83c87823a398af97275a44bc08febff4ec983efb84cb346a78234129925181a8faaa1fa88bb4803101cda9eee1ac95097dd1be6a023376e9b756c62f6fffb8f40e49c8ea804bf779e4f6a80a8755df696d23a557936acd1f94587cb32e9436f319c8072294e4fabf57bb2a0a18b5275b979dcdd55113a63e6a61dc195b9b152a97ebc70fc75a154935b257049c0df1352fca1473e9e8fe57ee771953107b87d8d24e02fe9c987ab4d318887a088fd466ae760158d1add654f3d8cd36b0a9add3d6903f8f5d68b236bff5115f7b13daa3f7b4f32b015c05ca6459666c879c41f39071231ba5e594c018a6b96fe8adc446ae1ed7b82b430f9d9f7bb8ca7dbc16372657e64b68c1e9bd258d4e0d1b3e7f15af0243e8039c8a3eaea2c6234953d8103807cca77f38a0990fbaa87afdb6f31e2b1bcd012877bc332aaf856480d81eb9575ca605f578865a66c367bfd36fa15cea699acba609f8d05db85c702d9cfbc8cbaa1dcfc9f3b5ef0f45767db93ae2e779e771112568a5ebb080b04792b59278f32826f34dd1b0a08d521c00cf44ecc6fe0ba8cde8fc10f317b707a40fb51af50a2c5719a7e22a36ff26470f38f73803268811a351fef4f5b28eb5da7a4263a0abf945971584b2b3920d2a63f6374b2e610bc6b6b4c9e781a75fca936639972ce5b9e35f01197dcd7ded4e8fb515f91d6fcb09941272c7f32af862a529ec938c8e52be551a0b54ae7f7dece443c57a8a712b84822a1d6c5d426c46055be722c59b4f9055f20730fd33af80039110310feccfd4847a7e1970324f7ee0e15d2a32f579b77f73942804ef2ff92dfb927e5735588f26c7ccd717f416d738c68f3e7a2c176e2a3570df47d0382c20d0f26a768ec9922f3c3178dcc490c0df4e567aa64f618845260515a3629a7645cb0338bbb8c8814f9f733041a3153b981a9ac442659b933eb9a9e6555398bae0c2bfbc3ccb3432d01102979e5cacbb3ce40f00fe0277589bad7a05b330419a37d26f22b14c7efd15df8b2a58a628b571a34beb91e522d9dc5f91c2dd244c766245bb35347fd89933e476c204c3bc896d9b6311041fc621d320d4a56bf44114f3ed42ed0bb1c1cfd6dc4553ef4c87ae6bb2bdd3fd17b6cc9aadd1ffb8e08591de680fedb92add9d8adaf1ccf4d5dcfaee259dcf1fe84eaf77cc57c310f0a0e92dfc36badb7$_$, 'z...j'
91+
)) to stdout with csv;
92+
```
93+
8194

8295
## 参考
8396
[《德说-第122期, 隆中对 - 五看三定四配-华为基本法-战略制定》](../202208/20220811_02.md)

202303/20230319_05_pic_001.jpg

121 KB
Loading

202303/20230320_01.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
## 程序员辅助编程利器只是AI应用的开始: cursor, An editor built for programming with AI
2+
3+
### 作者
4+
digoal
5+
6+
### 日期
7+
2023-03-20
8+
9+
### 标签
10+
PostgreSQL , PolarDB , chatgpt , openai , 辅助编程
11+
12+
----
13+
14+
## 背景
15+
程序员用得最多的是IDE, 编程工具. cursor这个厂商很有想法, 与GPT-4结合, 直接做了一个AI编程的editor, 与广大程序员建立了0距离连接.
16+
17+
推而广之: openai 将AI能力接口化, 确实会被非常方便的普及AI能力, 控制算法算力, 就像控制短信、网络流量一样, 是一门长期、市场容量天花板极高的生意. 那些占有大量用户时间(包括碎片时间)的产品该注意了, 随时可能被加持AI的产品颠覆, 成为新的用户入口.
18+
19+
这是一个辅助编程的“chatgpt” , 后台应用了openai的gpt技术. 当然解决的是编程的问题, 具备一定编程基础的同学, 可以大幅度提升编程效率. 对于没有编程能力的同学就别做梦了, 因为它给你的代码也不知道对不对, 而且总有需要你微调的地方.
20+
21+
An editor built for programming with AI
22+
23+
Build Software. Fast. Write, edit, and chat about your code with GPT-4
24+
25+
https://www.cursor.so/
26+
27+
28+
例子1: statistic from duckdb:
29+
30+
```
31+
// Welcome to Cursor
32+
33+
// 1. Try generating with command K on a new line. Ask for a new react component of an error popup.
34+
// 2. Then, select the outputted code and hit chat. Ask if there's a bug. Ask how to improve.
35+
// 3. Try selecting some code and hitting edit. Ask the bot to add a button that updates a statefield.
36+
// 4. To try out cursor on your own projects, go to file menu (top left) and open a folder.
37+
38+
39+
40+
import duckdb
41+
42+
# connect to the database
43+
con = duckdb.connect(database='/path/to/database.db')
44+
45+
# execute a query
46+
result = con.execute('SELECT COUNT(*) FROM my_table')
47+
48+
# fetch the result
49+
count = result.fetchone()[0]
50+
51+
# print the count
52+
print(f'Total rows in my_table: {count}')
53+
```
54+
55+
56+
例子2: write as rust, connect to duckdb, statistic something.
57+
58+
```
59+
use duckdb::{Connection, Result};
60+
61+
fn main() -> Result<()> {
62+
let conn = Connection::open("/path/to/database.db")?;
63+
let result = conn.query("SELECT COUNT(*) FROM my_table", &[])?;
64+
let count: i64 = result.fetch_one()?.get(0)?;
65+
println!("Total rows in my_table: {}", count);
66+
Ok(())
67+
}
68+
```
69+
70+
71+
例子3: write as rust, connect to postgresql, load data from csv file, modify it by some logical, finaly query it by some logical.
72+
73+
```
74+
use postgres::{Client, NoTls};
75+
use std::error::Error;
76+
use std::fs::File;
77+
use std::io::{BufRead, BufReader};
78+
79+
fn main() -> Result<(), Box<dyn Error>> {
80+
let mut client = Client::connect("postgresql://postgres:password@localhost:5432/mydb", NoTls)?;
81+
82+
let file = File::open("data.csv")?;
83+
let reader = BufReader::new(file);
84+
85+
for line in reader.lines() {
86+
let line = line?;
87+
let parts: Vec<&str> = line.split(',').collect();
88+
89+
let name = parts[0];
90+
let age = parts[1].parse::<i32>()?;
91+
let email = parts[2];
92+
93+
client.execute(
94+
"INSERT INTO users (name, age, email) VALUES ($1, $2, $3)",
95+
&[&name, &age, &email],
96+
)?;
97+
}
98+
99+
client.execute(
100+
"UPDATE users SET age = age + 1 WHERE age < 30",
101+
&[],
102+
)?;
103+
104+
let rows = client.query(
105+
"SELECT name, age, email FROM users WHERE age >= 30",
106+
&[],
107+
)?;
108+
109+
for row in rows {
110+
let name: &str = row.get(0);
111+
let age: i32 = row.get(1);
112+
let email: &str = row.get(2);
113+
114+
println!("{} ({}): {}", name, age, email);
115+
}
116+
117+
Ok(())
118+
}
119+
```
120+
121+
122+
123+
读不懂的地方, 还可以提问, 例如下面好多问号, 到底是什么意思, 你可以选中一个问号, 然后问它: `why here is a ?`
124+
125+
The `?` in the selected code block is used to propagate errors up the call stack. It is a shorthand for the `try!` macro. The `try!` macro is used to propagate errors up the call stack by returning early from the function if an error occurs. The `?` operator was introduced in Rust 1.13 as a more concise way of using the `try!` macro.
126+
127+
In the given code, `parts[1].parse::<i32>()?` is used to parse the second element of the parts vector as an `i32` and propagate any errors that occur during the parsing process up the call stack. If an error occurs, the function will return early with the error.
128+
129+
130+
131+
#### [期望 PostgreSQL|开源PolarDB 增加什么功能?](https://github.com/digoal/blog/issues/76 "269ac3d1c492e938c0191101c7238216")
132+
133+
134+
#### [PolarDB 云原生分布式开源数据库](https://github.com/ApsaraDB "57258f76c37864c6e6d23383d05714ea")
135+
136+
137+
#### [PolarDB 学习图谱: 训练营、培训认证、在线互动实验、解决方案、内核开发公开课、生态合作、写心得拿奖品](https://www.aliyun.com/database/openpolardb/activity "8642f60e04ed0c814bf9cb9677976bd4")
138+
139+
140+
#### [PostgreSQL 解决方案集合](../201706/20170601_02.md "40cff096e9ed7122c512b35d8561d9c8")
141+
142+
143+
#### [德哥 / digoal's github - 公益是一辈子的事.](https://github.com/digoal/blog/blob/master/README.md "22709685feb7cab07d30f30387f0a9ae")
144+
145+
146+
![digoal's wechat](../pic/digoal_weixin.jpg "f7ad92eeba24523fd47a6e1a0e691b59")
147+

202303/readme.md

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

33
### 文章列表
44
----
5+
##### 20230320_01.md [《程序员辅助编程利器只是AI应用的开始: cursor, An editor built for programming with AI》](20230320_01.md)
56
##### 20230319_05.md [《德说-第211期, okr 方法论: 以果决行&动态规划》](20230319_05.md)
67
##### 20230319_04.md [《德说-第210期, “信仰崩塌”可能会变成“常态”》](20230319_04.md)
78
##### 20230319_03.md [《德说-第209期, 《太乙金华宗旨》是科学》](20230319_03.md)
@@ -11,7 +12,7 @@
1112
##### 20230318_02.md [《记录下 在 debian 中部署 nvidia cuda 容器》](20230318_02.md)
1213
##### 20230318_01.md [《记录下 在 debian 宿主机中部署和使用 docker (常用docker命令、debian容器常用配置; debian容器部署duckdb和PostgreSQL例子)》](20230318_01.md)
1314
##### 20230317_02.md [《记录下 debian 在带Nvidia显卡笔记本上的部署 - 用于测试 cuda 应用》](20230317_02.md)
14-
##### 20230317_01.md [《德说-第208期, 如何与 ChatGPT代表的AI 合作?》](20230317_01.md)
15+
##### 20230317_01.md [《德说-第208期, 与AI合作将成为常态, 如何与 ChatGPT代表的AI 合作?》](20230317_01.md)
1516
##### 20230316_01.md [《从csv文件导入传感器数据到PostgreSQL的case, 每个传感器仅保留最新记录, 怎么做到最快?》](20230316_01.md)
1617
##### 20230315_04.md [《如何将blog发送到postgresql planet》](20230315_04.md)
1718
##### 20230315_03.md [《德说-第207期, 《超级版图》 - 人才连接线 & 数据资产》](20230315_03.md)

README.md

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

9494
### 所有文档如下
9595
----
96+
##### 202303/20230320_01.md [《程序员辅助编程利器只是AI应用的开始: cursor, An editor built for programming with AI》](202303/20230320_01.md)
9697
##### 202303/20230319_05.md [《德说-第211期, okr 方法论: 以果决行&动态规划》](202303/20230319_05.md)
9798
##### 202303/20230319_04.md [《德说-第210期, “信仰崩塌”可能会变成“常态”》](202303/20230319_04.md)
9899
##### 202303/20230319_03.md [《德说-第209期, 《太乙金华宗旨》是科学》](202303/20230319_03.md)
@@ -102,7 +103,7 @@ digoal's|PostgreSQL|文章|归类
102103
##### 202303/20230318_02.md [《记录下 在 debian 中部署 nvidia cuda 容器》](202303/20230318_02.md)
103104
##### 202303/20230318_01.md [《记录下 在 debian 宿主机中部署和使用 docker (常用docker命令、debian容器常用配置; debian容器部署duckdb和PostgreSQL例子)》](202303/20230318_01.md)
104105
##### 202303/20230317_02.md [《记录下 debian 在带Nvidia显卡笔记本上的部署 - 用于测试 cuda 应用》](202303/20230317_02.md)
105-
##### 202303/20230317_01.md [《德说-第208期, 如何与 ChatGPT代表的AI 合作?》](202303/20230317_01.md)
106+
##### 202303/20230317_01.md [《德说-第208期, 与AI合作将成为常态, 如何与 ChatGPT代表的AI 合作?》](202303/20230317_01.md)
106107
##### 202303/20230316_01.md [《从csv文件导入传感器数据到PostgreSQL的case, 每个传感器仅保留最新记录, 怎么做到最快?》](202303/20230316_01.md)
107108
##### 202303/20230315_04.md [《如何将blog发送到postgresql planet》](202303/20230315_04.md)
108109
##### 202303/20230315_03.md [《德说-第207期, 《超级版图》 - 人才连接线 & 数据资产》](202303/20230315_03.md)

0 commit comments

Comments
 (0)