PostgreSQL 10.0 preview 性能增强 - 支持64bit atomic

本文涉及的产品
云数据库 RDS SQL Server,基础系列 2核4GB
RDS SQL Server Serverless,2-4RCU 50GB 3个月
推荐场景:
RDS PostgreSQL Serverless,0.5-4RCU 50GB 3个月
推荐场景:
对影评进行热评分析
简介:

标签

PostgreSQL , 10.0 , atomic , spinlock


背景

起源

Add a basic atomic ops API abstracting away platform/architecture details.  
  
author	Andres Freund <andres@anarazel.de>	  
Fri, 26 Sep 2014 05:49:05 +0800 (23:49 +0200)  
committer	Andres Freund <andres@anarazel.de>	  
Fri, 26 Sep 2014 05:49:05 +0800 (23:49 +0200)  
commit	b64d92f1a5602c55ee8b27a7ac474f03b7aee340  
tree	2ac33fb70d31585297ae8baeb674ef757544a1d7	tree | snapshot  
parent	9111d46351e8c3d82452a7454e43ccbf1991b3dc	commit | diff  
Add a basic atomic ops API abstracting away platform/architecture details.  
  
Several upcoming performance/scalability improvements require atomic  
operations. This new API avoids the need to splatter compiler and  
architecture dependent code over all the locations employing atomic  
ops.  
  
For several of the potential usages it'd be problematic to maintain  
both, a atomics using implementation and one using spinlocks or  
similar. In all likelihood one of the implementations would not get  
tested regularly under concurrency. To avoid that scenario the new API  
provides a automatic fallback of atomic operations to spinlocks. All  
properties of atomic operations are maintained. This fallback -  
obviously - isn't as fast as just using atomic ops, but it's not bad  
either. For one of the future users the atomics ontop spinlocks  
implementation was actually slightly faster than the old purely  
spinlock using implementation. That's important because it reduces the  
fear of regressing older platforms when improving the scalability for  
new ones.  
  
The API, loosely modeled after the C11 atomics support, currently  
provides 'atomic flags' and 32 bit unsigned integers. If the platform  
efficiently supports atomic 64 bit unsigned integers those are also  
provided.  
  
To implement atomics support for a platform/architecture/compiler for  
a type of atomics 32bit compare and exchange needs to be  
implemented. If available and more efficient native support for flags,  
32 bit atomic addition, and corresponding 64 bit operations may also  
be provided. Additional useful atomic operations are implemented  
generically ontop of these.  
  
The implementation for various versions of gcc, msvc and sun studio have  
been tested. Additional existing stub implementations for  
* Intel icc  
* HUPX acc  
* IBM xlc  
are included but have never been tested. These will likely require  
fixes based on buildfarm and user feedback.  
  
As atomic operations also require barriers for some operations the  
existing barrier support has been moved into the atomics code.  
  
Author: Andres Freund with contributions from Oskari Saarenmaa  
Reviewed-By: Amit Kapila, Robert Haas, Heikki Linnakangas and Álvaro Herrera  
Discussion: CA+TgmoYBW+ux5-8Ja=Mcyuy8=VXAnVRHp3Kess6Pn3DMXAPAEA@mail.gmail.com,  
    20131015123303.GH5300@awork2.anarazel.de,  
    20131028205522.GI20248@awork2.anarazel.de  

10.0 新增64bit atomic支持

Improve 64bit atomics support.  
  
author	Andres Freund <andres@anarazel.de>	  
Sat, 8 Apr 2017 05:44:47 +0800 (14:44 -0700)  
committer	Andres Freund <andres@anarazel.de>	  
Sat, 8 Apr 2017 05:48:11 +0800 (14:48 -0700)  
commit	e8fdbd58fe564a29977f4331cd26f9697d76fc40  
tree	7ac78010b4ad51730fe948a79e7c5d7e5f461981	tree | snapshot  
parent	28afad5c85b436f19d9f2c0e3197c7db960fef6f	commit | diff  
Improve 64bit atomics support.  
  
When adding atomics back in b64d92f1a, I added 64bit support as  
optional; there wasn't yet a direct user in sight.  That turned out to  
be a bit short-sighted, it'd already have been useful a number of times.  
  
Add a fallback implementation of 64bit atomics, just like the one we  
have for 32bit atomics.  
  
Additionally optimize reads/writes to 64bit on a number of platforms  
where aligned writes of that size are atomic. This can now be tested  
with PG_HAVE_8BYTE_SINGLE_COPY_ATOMICITY.  
  
Author: Andres Freund  
Reviewed-By: Amit Kapila  
Discussion: https://postgr.es/m/20160330230914.GH13305@awork2.anarazel.de  

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

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

参考

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

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

相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
目录
相关文章
|
6月前
|
存储 关系型数据库 数据库
postgresql|数据库|提升查询性能的物化视图解析
postgresql|数据库|提升查询性能的物化视图解析
636 0
|
3月前
|
缓存 关系型数据库 数据库
PostgreSQL性能
【8月更文挑战第26天】PostgreSQL性能
67 1
|
2月前
|
缓存 关系型数据库 数据库
如何优化 PostgreSQL 数据库性能?
如何优化 PostgreSQL 数据库性能?
92 2
|
1月前
|
存储 关系型数据库 MySQL
四种数据库对比MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
四种数据库对比 MySQL、PostgreSQL、ClickHouse、MongoDB——特点、性能、扩展性、安全性、适用场景
|
2月前
|
缓存 关系型数据库 数据库
PostgreSQL的性能
PostgreSQL的性能
127 2
|
3月前
|
缓存 关系型数据库 数据库
PostgreSQL 查询性能
【8月更文挑战第5天】PostgreSQL 查询性能
74 8
|
3月前
|
关系型数据库 Java 数据库
PostgreSQL性能
【8月更文挑战第5天】PostgreSQL性能
93 7
|
3月前
|
监控 关系型数据库 数据库
如何优化PostgreSQL的性能?
【8月更文挑战第4天】如何优化PostgreSQL的性能?
230 7
|
存储 人工智能 关系型数据库
5倍性能提升,阿里云AnalyticDB PostgreSQL版新一代实时智能引擎重磅发布
2023 云栖大会上,AnalyticDB for PostgreSQL新一代实时智能引擎重磅发布,全自研计算和行列混存引擎较比开源Greenplum有5倍以上性能提升。AnalyticDB for PostgreSQL与通义大模型家族深度集成,推出一站式AIGC解决方案。阿里云新发布的行业模型及“百炼”平台,采用AnalyticDB for PostgreSQL作为内置向量检索引擎,性能较开源增强了2~5倍。大会上来自厦门国际银行、三七互娱等知名企业代表和瑶池数据库团队产品及技术资深专家们结合真实场景实践,深入分享了最新的技术进展和解析。
5倍性能提升,阿里云AnalyticDB PostgreSQL版新一代实时智能引擎重磅发布
|
存储 关系型数据库 Go
《深入PostgreSQL的存储引擎:原理与性能》
《深入PostgreSQL的存储引擎:原理与性能》
675 0

相关产品

  • 云原生数据库 PolarDB
  • 云数据库 RDS PostgreSQL 版