PostgresQL是一个功能强大的开源数据库系统。经过长达15年以上的积极开发和不断改进,PostgreSQL已在可靠性、稳定性、数据一致性等获得了业内极高的声誉。目前PostgreSql可以运行在所有主流操作系统上,包括Linux、Unix(AIX、BSD、HP-UX、SGIIRIX、MacOs X、Solaris和Tru64)和Windows。
作为一种企业级数据库,PostgresQL以它所具有的各种高级功能而自豪,像多版本并发控制(MVCC)、按时间点恢复(PITR)、表空间、异步复制、嵌套事务、在线热备、复杂查询的规划和优化以及为容错而进行的预写日志等。它支持国际字符集、多字节编码并支持使用当地语言进行排序、大小写处理和格式化等操作。
截止2024年三月份,postgresql数据库得分排名第四,且仍出现上升去世
来源:https://db-engines.com/en/ranking
极限值:
最大单个数据库大小: 不限
最大数据单表大小:32 TB
单条记录最大:1.6 TB
单字段最大允许:1 GB
单表允许最大记录数:不限
单表最大字段数:250-1600(取决于字段类型)
单表最大索引数:不限
PostgreSQL的存储过程开发可以使用众多的程序语言,包括Java、Perl、Python、Ruby、Tc1、C/C++和自带的PL/pgSQL,其中的PL/pgSQL与Oracle的PL/SQL很相似,内置了数百个函数,功能从基本的算术计算和字符串处理到加密逻辑计算并与0racle有高度兼容性。
由于有很多的存储过程语言可以使用,这样也产生了很多的库接口,这样允许各种编译型或是解释型的语言在PostgreSQL进行使用,包括Java(JDBC)、0DBC、Perl、Python、Ruby、C、C++、PHP、Lisp、Scheme和Qt等。
最重要的一点,PostgreSQL的源代码可以自由获取,它的授权是在非常自由的开源授权下,这种授权允许用户在各种开源或是闭源项目中使用、修改和发布PostgreSQL的源代码。用户对源代码的可以按用户意愿进行任何修改、改进。
Version | Current minor | Supported | First Release | Final Release |
---|---|---|---|---|
16 | 16.2 | Yes | September 14, 2023 | November 9, 2028 |
15 | 15.6 | Yes | October 13, 2022 | November 11, 2027 |
14 | 14.11 | Yes | September 30, 2021 | November 12, 2026 |
13 | 13.14 | Yes | September 24, 2020 | November 13, 2025 |
12 | 12.18 | Yes | October 3, 2019 | November 14, 2024 |
11 | 11.22 | No | October 18, 2018 | November 9, 2023 |
10 | 10.23 | No | October 5, 2017 | November 10, 2022 |
9.0 | 9.0.23 | No | September 20, 2010 | October 8, 2015 |
8.0 | 8.0.26 | No | January 19, 2005 | October 1, 2010 |
7.0 | 7.0.3 | No | May 8, 2000 | May 8, 2005 |
6.5 | 6.5.3 | No | June 9, 1999 | June 9, 2004 |
6.0 | 6.0.0 | No | March 1, 1998 | March 1, 2003 |
基于postgresql开发的数据库有很多种,这里只举例一些典型的数据库
2019年9月19日在全连接大会大会上,华为宣布将开源其数据库产品,开源后命名为openGauss。
openGauss是一款支持SQL2003标准语法,支持主备部署的高可用关系型数据库。
openGauss是一款提供面向多核的极致性能、全链路的业务和数据安全、基于AI的调优和高效运维的能力,全面友好开放,携手伙伴共同打造全球领先的企业级开源关系型数据库,采用木兰宽松许可证v2发行。openGauss深度融合华为在数据库领域多年的研发经验,结合企业级场景需求,持续构建竞争力特性。
opengauss是一个开源数据库,基于opengauss发行的商业数据库有中国移动磐维数据库,华为GaussDB等。
AntDB数据库始于2008年,在运营商的核心系统上,为全国24个省份的10亿多用户提供在线服务,具备高性能、弹性扩展、高可靠等产品特性,峰值每秒可处理百万笔通信核心交易,保障系统持续稳定运行近十年,并在通信、金融、交通、能源、物联网等行业成功商用落地。
https://www.bilibili.com/video/BV1bM411a7Fm
主要介绍postgresql在linux环境(BClinux for euler 21.10)的安装(包括编译安装和yum源安装),后期可能会补充在Windows,UOS等环境下的安装 pg版本以当前最新版本为主16.2 2.2章节主要介绍yum安装pg数据库。 2.3-2.x章节主要介绍通过编译源码方式安装数据库 关于yum源安装和编译安装的区别,可以见此篇介绍:
操作系统版本:BigCloud Enterprise Linux 21.10 (LTS-SP2)
[root@localhost ~]# cat /etc/os-release
NAME="BigCloud Enterprise Linux"
VERSION="21.10 (LTS-SP2)"
ID="bclinux"
VERSION_ID="21.10"
PRETTY_NAME="BigCloud Enterprise Linux For Euler 21.10 LTS"
ANSI_COLOR="0;31"
配置规格
8c-16G-200G
[root@localhost ~]# free -h
total used free shared buff/cache available
Mem: 15Gi 269Mi 14Gi 9.0Mi 329Mi 14Gi
Swap: 7.9Gi 0B 7.9Gi
[root@localhost ~]# free -m
total used free shared buff/cache available
Mem: 15502 269 14903 9 329 14827
Swap: 8071 0 8071
postgresql:https://www.postgresql.org/ftp/source/v16.2/
https://www.hostbuf.com/t/988.html
在postgresql官网,仅提供了主流linux发行版的安装包,其他linux发行版建议使用源码编译安装。
PostgreSQL is available integrated with the package management on most Linux platforms. When available, this is the recommended way to install PostgreSQL, since it provides proper integration with the operating system, including automatic patching and other management functionality. In other cases, most Linux systems also make it easy to build from source. PostgreSQL可以在大多数Linux平台上集成包管理。如果可用,这是建议的PostgreSQL安装方式,因为它提供了与操作系统的适当集成,包括自动修补和其他管理功能。 在其他情况下,大多数Linux系统也使从源代码构建变得容易。
由于我的主机为BClinux(基于openeuler),我使用类redhat安装尝试安装(https://www.postgresql.org/download/linux/redhat/)
打开上述网页,选择要对应的系统类型和版本,可以看到已经自动生成了安装脚本
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y postgresql16-server
sudo /usr/pgsql-16/bin/postgresql-16-setup initdb
sudo systemctl enable postgresql-16
sudo systemctl start postgresql-16
在主机上运行上述脚本
使用yum安装postgresql
首先查询镜像源的postgresql版本
可以看到系统源中postgresql版本为10.5
[root@localhost ~]# yum list | grep postgresql
postgresql.x86_64 10.5-23.oe1 @update
postgresql-contrib.x86_64 10.5-23.oe1 @update
postgresql-help.x86_64 10.5-23.oe1 @update
postgresql-libs.x86_64 10.5-23.oe1 @update
freeradius-postgresql.x86_64 3.0.15-24.oe1 everything
pcp-pmda-postgresql.x86_64 4.1.3-13.oe1 everything
postgresql-debuginfo.x86_64 10.5-23.oe1 update
postgresql-debugsource.x86_64 10.5-23.oe1 update
postgresql-devel.x86_64 10.5-23.oe1 update
postgresql-jdbc.noarch 42.2.25-1.oe1 update
postgresql-jdbc-help.noarch 42.2.25-1.oe1 update
postgresql-jdbc-javadoc.noarch 42.2.25-1.oe1 update
postgresql-plperl.x86_64 10.5-23.oe1 update
postgresql-plpython3.x86_64 10.5-23.oe1 update
postgresql-pltcl.x86_64 10.5-23.oe1 update
postgresql-server.x86_64 10.5-23.oe1 update
postgresql-static.x86_64 10.5-23.oe1 update
postgresql-test.x86_64 10.5-23.oe1 update
postgresql-test-rpm-macros.x86_64 10.5-23.oe1 update
proftpd-postgresql.x86_64 1.3.7a-1.oe1 everything
qt5-qtbase-postgresql.x86_64 5.11.1-12.oe1 everything
安装postgresql
[root@localhost ~]# yum install -y postgresql postgresql-contrib
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。