暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 14 preview - copy from 导入数据支持 batch, 大幅减少conversion/verification function calls, 支持并行处理

digoal 2021-01-04
204

作者

digoal

日期

2021-04-02

标签

PostgreSQL , copy from , 导入数据


背景

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

```
Do COPY FROM encoding conversion/verification in larger chunks.
author Heikki Linnakangas heikki.linnakangas@iki.fi
Thu, 1 Apr 2021 09:23:40 +0000 (12:23 +0300)
committer Heikki Linnakangas heikki.linnakangas@iki.fi
Thu, 1 Apr 2021 09:23:40 +0000 (12:23 +0300)
commit f82de5c46bdf8cd65812a7b04c9509c218e1545d
tree f9d687f0e1f50666a4a4cf8fbe366a2cd7e43d1c tree
parent ea1b99a6619cd9dcfd46b82ac0d926b0b80e0ae9 commit | diff
Do COPY FROM encoding conversion/verification in larger chunks.

This gives a small performance gain, by reducing the number of calls
to the conversion/verification function, and letting it work with
larger inputs. Also, reorganizing the input pipeline makes it easier
to parallelize the input parsing: after the input has been converted
to the database encoding, the next stage of finding the newlines can
be done in parallel, because there cannot be any newline chars
"embedded" in multi-byte characters in the encodings that we support
as server encodings.

This changes behavior in one corner case: if client and server
encodings are the same single-byte encoding (e.g. latin1), previously
the input would not be checked for zero bytes ('\0'). Any fields
containing zero bytes would be truncated at the zero. But if encoding
conversion was needed, the conversion routine would throw an error on
the zero. After this commit, the input is always checked for zeros.

Reviewed-by: John Naylor
Discussion: https://www.postgresql.org/message-id/e7861509-3960-538a-9025-b75a61188e01%40iki.fi
```

PostgreSQL 许愿链接

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

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论