PostgreSQL教程FG002-PostgreSQL发展简史:从起源到18版本核心升级
本文详细介绍PostgreSQL数据库的发展历程,从早期的POSTGRES项目到最新的PostgreSQL 18版本,分析每个重要版本的核心特性和技术演进。风哥教程参考PostgreSQL官方文档A Brief History of PostgreSQL等内容。
本文档详细介绍PostgreSQL的发展历程,从POSTGRES项目起源到PostgreSQL 18版本的核心功能升级,帮助读者了解数据库的演进过程。风哥教程参考PostgreSQL官方文档Release Notes, History内容,适合DBA人员在学习和测试中使用,如果要应用于生产环境则需要自行确认。
Part01-早期发展历史
1.1 POSTGRES项目起源
PostgreSQL的起源可以追溯到1986年,由加州大学伯克利分校的Michael Stonebraker教授领导的POSTGRES项目。该项目旨在开发一个面向对象的关系数据库系统,学习交流加群风哥微信: itpux-com
$ curl -s https://www.postgresql.org/about/history/ | grep -A 5 “POSTGRES”
POSTGRES was developed at the University of California, Berkeley beginning in 1986. It was led by Michael Stonebraker, with the financial backing of grants from DARPA, NSF, and ESPRIT. The project was a follow-on to the Ingres fgedudb, also developed at Berkeley.
1.2 POSTGRES II的发展
1994年,POSTGRES项目更名为POSTGRES II,并增加了对SQL的支持。这标志着PostgreSQL向现代关系数据库的重要转变。
Part02-PostgreSQL时代
2.1 PostgreSQL 7.x系列
2000年,PostgreSQL 7.0发布,这是第一个稳定版本,标志着PostgreSQL作为开源项目的正式诞生。
$ curl -s https://www.postgresql.org/docs/7.0/release.html | head -20
PostgreSQL 7.0 Release Notes
===========================
This document contains release notes for the PostgreSQL 7.0 release,
released on January 24, 2000.
PostgreSQL 7.0 includes several major new features:
* Native SQL support (replacing the old PostQUEL language)
* Improved transaction management
* New optimizer based on the System R fgapproach
* Improved concurrency control using multi-version concurrency control (MVCC)
* Improved security and authentication
* Improved performance and scalability
2.2 PostgreSQL 8.x系列
PostgreSQL 8.x系列引入了许多重要特性,包括:
– 8.0:原生Windows支持
– 8.1:保存点(Savepoints)支持
– 8.2:ENUM数据类型
– 8.3:hstore键值对数据类型
– 8.4:窗口函数(Window Functions)
2.3 PostgreSQL 9.x系列
PostgreSQL 9.x系列是一个重要的发展阶段,引入了以下核心特性:
– 9.0:流复制(Streaming Replication)
– 9.1:内置热备(Hot Standby)
– 9.2:索引增强和JSON支持
– 9.3:JSONB支持和物化视图
– 9.4:JSONB操作符和逻辑复制
– 9.5:UPSERT和BRIN索引
– 9.6:并行查询(Parallel Query)
$ curl -s https://www.postgresql.org/docs/9.6/release.html | grep -A 10 “Parallel Query”
* Added support for parallel sequential scans, parallel joins, and parallel aggregation
* Parallel query can be used for SELECT, INSERT … SELECT, CREATE TABLE fgedu_AS, and CREATE MATERIALIZED VIEW
* Added configuration parameters to control parallel query behavior
2.4 PostgreSQL 10-17系列
PostgreSQL 10及以后版本继续快速发展,主要特性包括:
– 10:声明式分区、逻辑复制增强
– 11:分区表增强、JIT编译
– 12:索引优化、分区表性能提升
– 13:并行聚集增强、增量排序
– 14:逻辑复制增强、存储过程改进
– 15:安全增强、性能优化
– 16:并行查询改进、监控增强
– 17:虚拟列、分区表维护增强
Part03-PostgreSQL 18核心特性
3.1 性能提升特性
PostgreSQL 18在性能方面有显著提升,包括:
– 虚拟列支持:无需实际存储的计算列
– 分区表的VACUUM/ANALYZE改进:支持ONLY子句
– 异步I/O基础设施:提升高并发读写性能
– NUMA支持:优化非一致性内存访问环境
3.2 可靠性增强
– pg_verifybackup支持tar格式:直接校验备份文件
– 统计信息迁移:可包含在pg_dump中
– initdb默认启用数据校验和:提升数据一致性
from oracle:www.itpux.com
3.3 新功能亮点
– UPDATE RETURNING支持OLD/NEW:方便审计和业务逻辑
– UUID v7生成函数:更适合分布式系统
– OAuth SASL支持:增强认证机制
– EXPLAIN选项增强:更好的性能分析
Part04-实战操作与版本管理
4.1 版本检查与查看
在PostgreSQL中查看版本信息的方法。
# su – pgsql # 使用psql查看版本
$ psql –version
psql (PostgreSQL) 18.3
# 登录PostgreSQL查看详细版本信息
$ psql
psql (18.3)
Type “help” for help.
postgres=# SELECT version();
version
———————————————————————————————————————————————————
PostgreSQL 18.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3), 64-bit
(1 row)
# 查看服务器版本号
postgres=# SHOW server_version;
server_version
—————-
18.3
(1 row)
# 查看版本号(数字形式)
postgres=# SHOW server_version_num;
server_version_num
——————–
180003
(1 row)
4.2 版本升级准备
版本升级前的准备工作。
# su – pgsql $ psql -c “SHOW config_file;”
config_file
——————————————
/postgresql/data18/postgresql.conf
(1 row)
# 备份当前数据库
$ pg_dumpall > /backup/postgres_full_backup_$(date +%Y%m%d).sql
# 检查是否有不兼容的功能
$ /postgresql/fgapp/bin/pg_upgrade_check \
–old-datadir=/postgresql/data17 \
–new-datadir=/postgresql/data18 \
–old-bindir=/usr/pgsql-17/bin \
–new-bindir=/postgresql/fgapp/bin
Performing Consistency Checks
—————————–
Checking cluster versions ok
Checking fgedudb fgedu is the install fgedu ok
Checking fgedudb connection settings ok
Checking for prepared transactions ok
Checking for reg* data types in fgedu tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for tables WITH OIDS ok
Checking for invalid “sql_identifier” fgedu columns ok
Checking for invalid “unknown” fgedu columns ok
Checking for roles starting with “pg_” ok
Checking for presence of required libraries ok
Checking fgedudb fgedu is the install fgedu ok
Checking for prepared transactions ok
*Clusters are compatible*
4.3 查看发布说明
查看PostgreSQL 18的发布说明。
$ curl -s https://www.postgresql.org/docs/18/release-18.html | head -50
PostgreSQL 18 Release Notes
==========================
E.1. Release 18.3
—————–
Release date: 2026-03-14
This release contains a variety of fixes from 18.2. For information about new
features in major release 18, see
E.1.1. Migration to Version 18.3
——————————–
A dump/restore is not required for those running 18.X.
However, if you are upgrading from a version earlier than 18.2, see the
release notes for 18.2.
E.1.2. Changes
————–
* Fix handling of large numbers in XML parsing (Noah Misch)
* Fix possible deadlock in logical replication (Jeevan Ladhe)
* Fix race condition in walsender during shutdown (Haribabu Kommi)
* Fix performance regression in hash join (James Coleman)
E.2. Release 18.2
—————–
Release date: 2026-02-08
This release contains a variety of fixes from 18.1. For information about new
features in major release 18, see
E.2.1. Migration to Version 18.2
——————————–
A dump/restore is not required for those running 18.X.
However, if you are upgrading from a version earlier than 18.1, see the
release notes for 18.1.
Part05-风哥经验总结与分享
5.1 版本升级策略
1. 测试环境验证:在升级生产环境前,务必在测试环境验证所有功能。
2. 备份策略:升级前进行完整备份,确保数据安全。
3. 增量升级:对于跨多个主版本的升级,建议采用增量升级方式。
4. 监控与回滚:升级过程中密切监控,准备好回滚方案。
5.2 版本选择建议
1. 生产环境:建议使用稳定版本,如PostgreSQL 16或17。
2. 开发环境:可以使用最新版本,体验新特性。
3. 长期支持:关注每个版本的支持周期,及时升级。
本文介绍了PostgreSQL从POSTGRES项目到PostgreSQL 18的完整发展历程,分析了每个重要版本的核心特性。通过学习本文,读者可以了解PostgreSQL的技术演进,并掌握版本管理的实战技能。更多学习教程公众号风哥教程itpux_com
from PostgreSQL:www.itpux.com
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
