Skip to content

Files

Latest commit

Dec 15, 2023
f400df2 · Dec 15, 2023

History

History
68 lines (40 loc) · 3.11 KB

20210715_01.md

File metadata and controls

68 lines (40 loc) · 3.11 KB

PostgreSQL 15 preview - psql 客户端copy支持larger chunk, 提高速度

作者

digoal

日期

2021-07-15

标签

PostgreSQL , psql , copy


背景

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=eec57115e4c866f26bdc8bcbe3e2e7be4c6d0450

In psql \copy from, send data to server in larger chunks.  
author	Heikki Linnakangas <heikki.linnakangas@iki.fi>	  
Wed, 14 Jul 2021 10:08:28 +0000 (13:08 +0300)  
committer	Heikki Linnakangas <heikki.linnakangas@iki.fi>	  
Wed, 14 Jul 2021 10:08:28 +0000 (13:08 +0300)  
commit	eec57115e4c866f26bdc8bcbe3e2e7be4c6d0450  
tree	90b277e1b9f9f7354818d8b1e1f28ce726828e6f	tree  
parent	b4deefc39b933b9808645667117f2d8208092794	commit | diff  
In psql \copy from, send data to server in larger chunks.  
  
Previously, we would send each line as a separate CopyData message.  
That's pretty wasteful if the table is narrow, as each CopyData message  
has 5 bytes of overhead. For efficiency, buffer up and pack 8 kB of  
input data into each CopyData message.  
  
The server also sends each line as a separate CopyData message in COPY TO  
STDOUT, and that's similarly wasteful. But that's documented in the FE/BE  
protocol description, so changing that would be a wire protocol break.  
  
Reviewed-by: Aleksander Alekseev  
Discussion: https://www.postgresql.org/message-id/40b2cec0-d0fb-3191-2ae1-9a3fe16a7e48%40iki.fi  

《PostgreSQL 服务端COPY和客户端COPY - 暨PG有哪些服务端操作接口》

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

digoal's wechat