127
. . . . . . PostgreSQL 介绍 刘鑫 <[email protected]> PostgreSQL 特色及最新版 July 20, 2010

PostgreSQL Introduction V0.1

Embed Size (px)

DESCRIPTION

初版

Citation preview

Page 1: PostgreSQL Introduction V0.1

. . . . . .

PostgreSQL 介绍

刘鑫 <[email protected]>

PostgreSQL 特色及最新版

July 20, 2010

Page 2: PostgreSQL Introduction V0.1

. . . . . .

我不认为这是在吹牛!

PostgreSQL: The world’s most advanced open source databasehttp://www.postgresql.org

Page 3: PostgreSQL Introduction V0.1

. . . . . .

1975 - 1977

INGRES 项目1

1urlhttp://db.cs.berkeley.edu//papers/ERL-M85-95.pdf

Page 4: PostgreSQL Introduction V0.1

. . . . . .

1983

分布式数据库

Page 5: PostgreSQL Introduction V0.1

. . . . . .

1983

有序关系

Page 6: PostgreSQL Introduction V0.1

. . . . . .

1983

抽象数据类型

Page 7: PostgreSQL Introduction V0.1

. . . . . .

1984

QUEL as a data type

Page 8: PostgreSQL Introduction V0.1

. . . . . .

1986 年

伯克利系的数据库研究项目:POSTGRES 2

2urlhttp://www.pgsqldb.org/pgsqldoc-cvs/history.html

Page 9: PostgreSQL Introduction V0.1

. . . . . .

感谢领导

Michael Stonebraker

Page 10: PostgreSQL Introduction V0.1

. . . . . .

感谢国家

防务高级研究项目局(DARPA)

Page 11: PostgreSQL Introduction V0.1

. . . . . .

继续感谢国家

陆军研究办公室(ARO)

Page 12: PostgreSQL Introduction V0.1

. . . . . .

不过都是美国的

国家科学基金(NSF)

Page 13: PostgreSQL Introduction V0.1

. . . . . .

感谢民企,不过也是美国的

ESL , Inc

Page 14: PostgreSQL Introduction V0.1

. . . . . .

1987 年

第一个“演示性”系统

Page 15: PostgreSQL Introduction V0.1

. . . . . .

1988 年

ACM-SIGMOD 大会

Page 16: PostgreSQL Introduction V0.1

. . . . . .

1989 年

发布版本 1

Page 17: PostgreSQL Introduction V0.1

. . . . . .

1990 年

发布版本 2

Page 18: PostgreSQL Introduction V0.1

. . . . . .

1991 年

发布版本 3

Page 19: PostgreSQL Introduction V0.1

. . . . . .

1990 年

发布版本 2

Page 20: PostgreSQL Introduction V0.1

. . . . . .

POSTGRES 在许多研究或实际的应用中得到了应用

Page 21: PostgreSQL Introduction V0.1

. . . . . .

财务数据分析系统

Page 22: PostgreSQL Introduction V0.1

. . . . . .

喷气引擎性能监控软件包

Page 23: PostgreSQL Introduction V0.1

. . . . . .

小行星跟踪数据库

Page 24: PostgreSQL Introduction V0.1

. . . . . .

医疗信息数据库

Page 25: PostgreSQL Introduction V0.1

. . . . . .

地理信息系统

Page 26: PostgreSQL Introduction V0.1

. . . . . .

大学教学

Page 27: PostgreSQL Introduction V0.1

. . . . . .

Illustra Information Technologies Illustra Information Technologies(后来并入 Informix)拿到代码并使之商业化

Page 28: PostgreSQL Introduction V0.1

. . . . . .

1992 年

成为 Sequoia 2000 科学计算项目的首要数据管理器。

Page 29: PostgreSQL Introduction V0.1

. . . . . .

1994 年

Postgres 项目终止于 4.2 版

Page 30: PostgreSQL Introduction V0.1

. . . . . .

情何以堪……

据说是因为用户太多了,作者觉得耽误了学术研究……

Page 31: PostgreSQL Introduction V0.1

. . . . . .

感谢香港!

Andrew Yu 和 Jolly Chen 向 POSTGRES 中增加了 SQL 语言的解释器,开源成为 Postgres 95

Page 32: PostgreSQL Introduction V0.1

. . . . . .

记得先感谢国家!

PostgreSQL 的历程开始了!

Page 33: PostgreSQL Introduction V0.1

. . . . . .

完备的关系模型

Page 34: PostgreSQL Introduction V0.1

. . . . . .

面向对象支持

Page 35: PostgreSQL Introduction V0.1

. . . . . .

丰富的数据类型,针对多种行业的业务需要

Page 36: PostgreSQL Introduction V0.1

. . . . . .

各种 contrib 的强力支持

Page 37: PostgreSQL Introduction V0.1

. . . . . .

强大的 OLAP 支持

Page 38: PostgreSQL Introduction V0.1

. . . . . .

强大的服务器端开发能力

Page 39: PostgreSQL Introduction V0.1

. . . . . .

性能稳定,抗压能力好

Page 40: PostgreSQL Introduction V0.1

. . . . . .

支持完整的关系数据模型

Page 41: PostgreSQL Introduction V0.1

. . . . . .

基本的表 / 字段结构

Page 42: PostgreSQL Introduction V0.1

. . . . . .

基本的主外键约束

Page 43: PostgreSQL Introduction V0.1

. . . . . .

check 约束

Page 44: PostgreSQL Introduction V0.1

. . . . . .

存储过程

Page 45: PostgreSQL Introduction V0.1

. . . . . .

触发器

Page 46: PostgreSQL Introduction V0.1

. . . . . .

可靠的索引支持

Page 47: PostgreSQL Introduction V0.1

. . . . . .

各种内置的通用和专用类型

Page 48: PostgreSQL Introduction V0.1

. . . . . .

数值——浮点和整形

Page 49: PostgreSQL Introduction V0.1

. . . . . .

鄙视没有精确实数的“企业级”平台

数值——精确实数 Numeric

Page 50: PostgreSQL Introduction V0.1

. . . . . .

出于兼容目的 varchar

Page 51: PostgreSQL Introduction V0.1

. . . . . .

二进制对象

Page 52: PostgreSQL Introduction V0.1

. . . . . .

无限文本 Text

Page 53: PostgreSQL Introduction V0.1

. . . . . .

丰富的几何类型,点、线,各种几何形状……

Page 54: PostgreSQL Introduction V0.1

. . . . . .

位串 bits

Page 55: PostgreSQL Introduction V0.1

. . . . . .

时间日期 / 时段类型

Page 56: PostgreSQL Introduction V0.1

. . . . . .

IP

Page 57: PostgreSQL Introduction V0.1

. . . . . .

UUID

Page 58: PostgreSQL Introduction V0.1

. . . . . .

全文索引

Page 59: PostgreSQL Introduction V0.1

. . . . . .

数组

Page 60: PostgreSQL Introduction V0.1

. . . . . .

组合类型

Page 61: PostgreSQL Introduction V0.1

. . . . . .

……

Page 62: PostgreSQL Introduction V0.1

. . . . . .

PostgreSQL 可以强大到成为一个开发平台。

Page 63: PostgreSQL Introduction V0.1

. . . . . .

简单查询

Page 64: PostgreSQL Introduction V0.1

. . . . . .

标准的 JOIN 关联查询

Page 65: PostgreSQL Introduction V0.1

. . . . . .

子查询

Page 66: PostgreSQL Introduction V0.1

. . . . . .

统一友好的基本格式是后续内容的基础

Page 67: PostgreSQL Introduction V0.1

. . . . . .

这个其实没啥可惊喜的……

基本的 group by 支持

Page 68: PostgreSQL Introduction V0.1

. . . . . .

在 8.4 版经历了一次性能优化

确认:PG 的 Group By 是根据存储分区进行并行计算的。

Page 69: PostgreSQL Introduction V0.1

. . . . . .

说实话有些我还没弄懂 ==

丰富的统计函数支持

Page 70: PostgreSQL Introduction V0.1

. . . . . .

Window 功能

Page 71: PostgreSQL Introduction V0.1

. . . . . .

强劲的并发能力是复杂数据挖掘的保障

Page 72: PostgreSQL Introduction V0.1

. . . . . .

强大的文本处理能力

Page 73: PostgreSQL Introduction V0.1

. . . . . .

无限 TEXT

Page 74: PostgreSQL Introduction V0.1

. . . . . .

正则表达式

Page 75: PostgreSQL Introduction V0.1

. . . . . .

全文检索

Page 76: PostgreSQL Introduction V0.1

. . . . . .

中文分词

Page 77: PostgreSQL Introduction V0.1

. . . . . .

友好的函数调用方式,有效提升开发能力

Page 78: PostgreSQL Introduction V0.1

. . . . . .

标量函数调用的缩写方式

select foo();

Page 79: PostgreSQL Introduction V0.1

. . . . . .

常见的函数调用方式

select foo(...) from ...;

Page 80: PostgreSQL Introduction V0.1

. . . . . .

函数可以返回一个结果集,作为数据集操作select ... from foo();

Page 81: PostgreSQL Introduction V0.1

. . . . . .

支持命名参数和变参!

Page 82: PostgreSQL Introduction V0.1

. . . . . .

当然,基本的 out 参数什么的,也都没有问题

Page 83: PostgreSQL Introduction V0.1

. . . . . .

函数定义(含代码块封装格式)

CREATE FUNCTION h e l l o ( ) RETURNS TEXT AS $$SELECT ’ H e l l o wor ld ’ AS r e s u l t ;

$$ LANGUAGE SQL ;

Page 84: PostgreSQL Introduction V0.1

. . . . . .

安装 PLSQL

Page 85: PostgreSQL Introduction V0.1

. . . . . .

9.0 中已经是默认安装

Page 86: PostgreSQL Introduction V0.1

. . . . . .

在函数中使用 PLSQL

Page 87: PostgreSQL Introduction V0.1

. . . . . .

基本格式

Page 88: PostgreSQL Introduction V0.1

. . . . . .

变量处理

Page 89: PostgreSQL Introduction V0.1

. . . . . .

隐式游标循环

Page 90: PostgreSQL Introduction V0.1

. . . . . .

逻辑判断

Page 91: PostgreSQL Introduction V0.1

. . . . . .

显式游标

Page 92: PostgreSQL Introduction V0.1

. . . . . .

可写游标

Page 93: PostgreSQL Introduction V0.1

. . . . . .

嵌套游标

Page 94: PostgreSQL Introduction V0.1

. . . . . .

return

Page 95: PostgreSQL Introduction V0.1

. . . . . .

return query

Page 96: PostgreSQL Introduction V0.1

. . . . . .

return next

Page 97: PostgreSQL Introduction V0.1

. . . . . .

异常与错误处理

Page 98: PostgreSQL Introduction V0.1

. . . . . .

事务

Page 99: PostgreSQL Introduction V0.1

. . . . . .

安装新语言

Page 100: PostgreSQL Introduction V0.1

. . . . . .

PL/Python

Page 101: PostgreSQL Introduction V0.1

. . . . . .

PL/Perl

Page 102: PostgreSQL Introduction V0.1

. . . . . .

PL/Sh

Page 103: PostgreSQL Introduction V0.1

. . . . . .

PL/Java

Page 104: PostgreSQL Introduction V0.1

. . . . . .

自由扩展的接口

Page 105: PostgreSQL Introduction V0.1

. . . . . .

数据分区

Page 106: PostgreSQL Introduction V0.1

. . . . . .

分区场景中的索引

Page 107: PostgreSQL Introduction V0.1

. . . . . .

分区场景中的查询

Page 108: PostgreSQL Introduction V0.1

. . . . . .

冷备

Page 109: PostgreSQL Introduction V0.1

. . . . . .

热备与温备

Page 110: PostgreSQL Introduction V0.1

. . . . . .

slony-i

Page 111: PostgreSQL Introduction V0.1

. . . . . .

standby

Page 112: PostgreSQL Introduction V0.1

. . . . . .

standby 策略

Page 113: PostgreSQL Introduction V0.1

. . . . . .

standby 策略

Page 114: PostgreSQL Introduction V0.1

. . . . . .

索引的影响

Page 115: PostgreSQL Introduction V0.1

. . . . . .

性能剖分

Page 116: PostgreSQL Introduction V0.1

. . . . . .

数据库分切对性能的影响

Page 117: PostgreSQL Introduction V0.1

. . . . . .

缓存

Page 118: PostgreSQL Introduction V0.1

. . . . . .

锁与连接状态

Page 119: PostgreSQL Introduction V0.1

. . . . . .

postgresql.conf

Page 120: PostgreSQL Introduction V0.1

. . . . . .

pg hba.conf

Page 121: PostgreSQL Introduction V0.1

. . . . . .

其它认证方式

Page 122: PostgreSQL Introduction V0.1

. . . . . .

设计大局观

Page 123: PostgreSQL Introduction V0.1

. . . . . .

可靠性

Page 124: PostgreSQL Introduction V0.1

. . . . . .

开发

Page 125: PostgreSQL Introduction V0.1

. . . . . .

Map Reduce 与 OLAP

Page 126: PostgreSQL Introduction V0.1

. . . . . .

无限位串

Page 127: PostgreSQL Introduction V0.1

. . . . . .

搜索引擎