PostgreSQL 10.0 preview 性能提升 - radix tree提升字符编码转换性能

less than 1 minute read

背景

PostgreSQL 10.0 使用radix tree提升UTF-8与其他字符编码转换的性能。

编码map文件按新的radix tree编排,性能相比binary search好了很多。

Use radix tree for character encoding conversions.  
  
author	Heikki Linnakangas <heikki.linnakangas@iki.fi>	  
Mon, 13 Mar 2017 18:46:39 +0000 (20:46 +0200)  
committer	Heikki Linnakangas <heikki.linnakangas@iki.fi>	  
Mon, 13 Mar 2017 18:46:39 +0000 (20:46 +0200)  
Replace the mapping tables used to convert between UTF-8 and other  
character encodings with new radix tree-based maps. Looking up an entry in  
a radix tree is much faster than a binary search in the old maps. As a  
bonus, the radix tree representation is also more compact, making the  
binaries slightly smaller.  
  
The "combined" maps work the same as before, with binary search. They are  
much smaller than the main tables, so it doesn't matter so much. However,  
the "combined" maps are now stored in the same .map files as the main  
tables. This seems more clear, since they're always used together, and  
generated from the same source files.  
  
Patch by Kyotaro Horiguchi, with lot of hacking by me at various stages.  
Reviewed by Michael Paquier and Daniel Gustafsson.  
  
Discussion: https://www.postgresql.org/message-id/20170306.171609.204324917.horiguchi.kyotaro%40lab.ntt.co.jp  

这个patch的讨论,详见邮件组,本文末尾URL。

PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。

参考

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=aeed17d00037950a16cc5ebad5b5592e5fa1ad0f

Flag Counter

digoal’s 大量PostgreSQL文章入口