PostgreSQL 11 preview - 通用场景性能 增强 汇总

本文涉及的产品
云原生数据库 PolarDB MySQL 版,Serverless 5000PCU 100GB
云原生数据库 PolarDB 分布式版,标准版 2核8GB
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

标签

PostgreSQL , 通用场景性能 , 增强 , 11


背景

PostgreSQL 11 通用场景性能增强。

E.1.3.1.5. General Performance

  • Add Just-In-Time (JIT) compilation of some parts of query plans to improve execution speed (Andres Freund)

    提高OLAP性能(海量数据处理,多表达式计算场景),动态编译,提高效率,结合列存储,CPU向量计算性能更加。

    《PostgreSQL 11 preview - JIT接口放开》

    《PostgreSQL 11 preview - with_llvm JIT支持部署与试用》

  • Allow bitmap scans to perform index-only scans when possible (Alexander Kuzmenkov)

    index only scan支持bitmapscan。

  • Update the free space map during vacuum (Claudio Freire)

    This allows free space to be reused more quickly.

  • Allow vacuum to avoid unnecesary index scans (Masahiko Sawada, Alexander Korotkov)

  • Improve performance of committing multiple concurrent transactions (Amit Kapila)

    并发提交事务性能提升,实测高并发COMMIT比PG 10好很多。

  • Reduce memory usage for queries using set-returning functions in their target lists (Andres Freund)

    降低调用srf函数的QUERY的内存使用。

  • Allow postgres_fdw to push UPDATEs and DELETEs using joins to foreign servers (Etsuro Fujita)

    Previously only non-join UPDATEs and DELETEs were pushed.

    postgres_fdw外部表下推增强,PostgreSQL 11允许包含JOIN的update,delete SQL下推。

测试

create table t_loc1 (id int, info text);    
create table t_loc2 (id int, info text);    
    
create extension postgres_fdw;    
    
CREATE SERVER foreign_server    
  FOREIGN DATA WRAPPER postgres_fdw    
  OPTIONS (host '127.0.0.1', port '4000', dbname 'postgres');    
    
CREATE USER MAPPING FOR postgres    
        SERVER foreign_server    
        OPTIONS (user 'postgres', password 'password');    
    
CREATE FOREIGN TABLE ft_loc1 (    
        id integer,    
        info text    
)    
        SERVER foreign_server    
        OPTIONS (schema_name 'public', table_name 't_loc1');    
    
    
CREATE FOREIGN TABLE ft_loc2 (    
        id integer,    
        info text    
)    
        SERVER foreign_server    
        OPTIONS (schema_name 'public', table_name 't_loc2');    
    
set enable_mergejoin=off;    
set enable_hashjoin=off;    

PostgreSQL 11, select, update, delete join都下推。

postgres=# explain verbose select t1.* from ft_loc1 t1 join ft_loc2 t2 using (id);    
                                                   QUERY PLAN                                                       
----------------------------------------------------------------------------------------------------------------    
 Foreign Scan  (cost=100.00..166443.65 rows=319523 width=36)    
   Output: t1.id, t1.info    
   Relations: (public.ft_loc1 t1) INNER JOIN (public.ft_loc2 t2)    
   Remote SQL: SELECT r1.id, r1.info FROM (public.t_loc1 r1 INNER JOIN public.t_loc2 r2 ON (((r1.id = r2.id))))    
(4 rows)    
    
postgres=# explain verbose update ft_loc1 t1 set info=t2.info from ft_loc2 t2 where t1.id=t2.id;    
                                                  QUERY PLAN                                                      
--------------------------------------------------------------------------------------------------------------    
 Update on public.ft_loc1 t1  (cost=100.00..68647.09 rows=131545 width=102)    
   ->  Foreign Update  (cost=100.00..68647.09 rows=131545 width=102)    
         Remote SQL: UPDATE public.t_loc1 r1 SET info = r2.info FROM public.t_loc2 r2 WHERE ((r1.id = r2.id))    
(3 rows)    

PostgreSQL 10, select join下推,但是update,delete join没有下推。

postgres=# explain verbose select t1.* from ft_loc1 t1 join ft_loc2 t2 using (id);    
                                                   QUERY PLAN                                                       
----------------------------------------------------------------------------------------------------------------    
 Foreign Scan  (cost=100.00..10543.72 rows=19963 width=36)    
   Output: t1.id, t1.info    
   Relations: (public.ft_loc1 t1) INNER JOIN (public.ft_loc2 t2)    
   Remote SQL: SELECT r1.id, r1.info FROM (public.t_loc1 r1 INNER JOIN public.t_loc2 r2 ON (((r1.id = r2.id))))    
(4 rows)    
    
postgres=# explain verbose update ft_loc1 t1 set info=t2.info from ft_loc2 t2 where t1.id=t2.id;    
                                                                                                   QUERY PLAN                                                                                                        
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------    
 Update on public.ft_loc1 t1  (cost=100.00..4422.55 rows=8215 width=102)    
   Remote SQL: UPDATE public.t_loc1 SET info = $2 WHERE ctid = $1    
   ->  Foreign Scan  (cost=100.00..4422.55 rows=8215 width=102)    
         Output: t1.id, t2.info, t1.ctid, t2.*    
         Relations: (public.ft_loc1 t1) INNER JOIN (public.ft_loc2 t2)    
         Remote SQL: SELECT r1.id, r1.ctid, r2.info, CASE WHEN (r2.*)::text IS NOT NULL THEN ROW(r2.id, r2.info) END FROM (public.t_loc1 r1 INNER JOIN public.t_loc2 r2 ON (((r1.id = r2.id)))) FOR UPDATE OF r1    
         ->  Nested Loop  (cost=200.00..24958.51 rows=8215 width=102)    
               Output: t1.id, t1.ctid, t2.info, t2.*    
               Join Filter: (t1.id = t2.id)    
               ->  Foreign Scan on public.ft_loc1 t1  (cost=100.00..182.27 rows=2409 width=10)    
                     Output: t1.id, t1.ctid    
                     Remote SQL: SELECT id, ctid FROM public.t_loc1 FOR UPDATE    
               ->  Materialize  (cost=100.00..133.87 rows=682 width=96)    
                     Output: t2.info, t2.*, t2.id    
                     ->  Foreign Scan on public.ft_loc2 t2  (cost=100.00..130.46 rows=682 width=96)    
                           Output: t2.info, t2.*, t2.id    
                           Remote SQL: SELECT id, info FROM public.t_loc2    
(17 rows)    
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
2月前
|
存储 SQL 关系型数据库
MySQL - 深入理解锁机制和实战场景
MySQL - 深入理解锁机制和实战场景
|
3月前
|
关系型数据库 MySQL
电子好书发您分享《MySQL高并发场景实战》
电子好书发您分享《MySQL高并发场景实战》
23 1
|
4月前
|
存储 SQL 关系型数据库
PolarDB这个sql行存和列存性能差别好大 ,为什么?
PolarDB这个sql行存和列存性能差别好大 ,为什么?
33 0
|
4月前
|
存储 关系型数据库 数据库
postgresql|数据库|提升查询性能的物化视图解析
postgresql|数据库|提升查询性能的物化视图解析
154 0
|
3月前
|
存储 SQL 关系型数据库
系统设计场景题—MySQL使用InnoDB,通过二级索引查第K大的数,时间复杂度是多少?
系统设计场景题—MySQL使用InnoDB,通过二级索引查第K大的数,时间复杂度是多少?
46 1
系统设计场景题—MySQL使用InnoDB,通过二级索引查第K大的数,时间复杂度是多少?
|
3月前
|
关系型数据库 MySQL Serverless
阿里云云原生数据库 PolarDB MySQL Serverless:卓越的性能与无与伦比的弹性
阿里云原生数据库 PolarDB MySQL Serverless 拥有卓越性能和无与伦比的弹性。通过实验体验,深入了解其基本管理和配置、智能弹性伸缩特性和全局一致性特性。实验包括主节点和只读节点的弹性压测以及全局一致性测试,旨在亲身体验 PolarDB 的强大性能。通过实验,可以更好地在实际业务场景中应用 PolarDB,并根据需求进行性能优化和调整。
679 2
|
3月前
|
存储 关系型数据库 分布式数据库
阿里云PolarDB解决乐麦多源数据存储性能问题
乐麦通过使用PolarDB数据库,使整个系统之间的数据查询分析更加高效
390 3
|
3月前
|
关系型数据库 数据挖掘 分布式数据库
报名预约|体验PolarDB澎湃性能与高性价比在线直播
「飞天技术沙龙数据库技术周」直播聚焦PolarDB产品体验
|
3月前
|
关系型数据库 MySQL 分布式数据库
PolarDB MySQL企业版产品系列:满足不同场景需求的解决方案
PolarDB MySQL企业版产品系列:满足不同场景需求的解决方案 在数字化时代,企业对于数据处理的需求越来越多样化,对于数据库的选择也更为谨慎。PolarDB MySQL版为了满足不同场景的需求,提供了单节点、集群版、高压缩引擎(X-Engine)和多主集群(库表)4种不同的产品系列。下面我们将对这4种产品系列进行简要介绍,以帮助您更好地了解它们的特点和适用场景。
120 1
|
4月前
|
关系型数据库 MySQL 分布式数据库
PolarDB auto_inc场景下的性能优化实践
PolarDB auto_inc场景下的性能优化实践 在数据库的使用场景中,并发插入数据或并发导入数据场景是最常见的。针对这一场景,PolarDB MySQL版进行了深度性能优化,以提高插入性能。本文将详细介绍PolarDB在auto_inc场景下的性能优化相关内容。
63 2

相关产品

  • 云原生数据库 PolarDB