PostgresChina 2018 张启程 为什么我们抛弃MongoDB和MySQL,选择PgSQL
为什么我们抛弃MongoDB和 MySQL,选择PgSQL 张启程 qc@aochuang.cn 奥创软件研究院(上海)研发中心 2018年PostgreSQL中国技术大会 任何数据库都很好用 • 我不是一个专业的DBA ,对数据库的理解不够深入,也不 一定准确,在此抛砖引玉,只是结合我们团队业务场景来 分享下我们选择数据库的过程。 • 不是数据库不好用, • 而是我们不会用, • 需求变更频繁,不适合关系型数据库 2018年PostgreSQL中国技术大会 目前服务器架构 2018年PostgreSQL中国技术大会 MySQL应用史 • 最开始做的站群系统WEB端使用MySQL: • copy简单快速,批量复制,替换修改简单; • 每个网站一个库,单体数据量小,数据类型固定; • 后来做SCRM系统,也首选MySQL: • 需求经常改动,每次改需求先改数据库; • 数据量越来越大,越来越不了解这只海豚; 2018年PostgreSQL中国技术大会 MySQL+MongoDB • 迫于无奈,分拆数据,将需要用到事务、调用频繁的数据 继续用MySQL,将IM中聊天记录等数据量大的数据,用 MongoDB存储,减轻MySQL负担; • 这种方式虽然可以暂时解决问题,我们自己用也没有任何 问题,可以结合各自数据库优点,发挥性能。但是我们有 很多客户是需要私有化部署数据库,让每家客户都接受这 种方式,会为甲方增加很多服务器以及运维成本,可能客0 码力 | 9 页 | 563.82 KB | 1 年前3阿里云 AnalyticDB for PostgreSQL - 打造更简单易用的Cloud SQL Data Warehouse
Greenplum再到Hadoop以及最终到 ODPS的架构演进工作。 ⚫ 2012年起,转至阿里巴巴大数据团队,负责Hbase/OTS业务支 撑,期间多次负责阿里大数据双11架构和稳定性工作 ⚫ 2018年,在阿里云数据库负责OLAP产品管理团队。 1. Greenplum发展史 @Alibaba 2. AnalyticDB for PostgreSQL产品介绍 3. AnalyticDB for PostgreSQL AnalyticDB for MySQL 实时数仓 ⚫ All In One数仓去O ⚫ 交互式分析 ⚫ 中小规模实时数仓 小烟枪在阿里的场景裂变 Greenplum发展史@Alibaba 产品云化-服务中小企业 IaaS、PaaS、SaaS皆云化-大势所趋 阿里云能够提供一站式的分析解决方案 PostgreSQL的生态发展迅猛 大数据发展势头放缓 数据库更简单易用 为什么要提供Greenplum云服务 应用易开发、适配 支持SQL 2003,部分兼容Oracle语法, 支持PL/SQL 存储过程,OLAP窗口函数,事务及数据库标准隔离级别 完备功能和生态,实现应用快速迁移或适配 • PB级数据秒级响应 MPP水平扩展架构,PB级数据查询秒级响应;向量化计算,及列存储智能索引,领先传统数据库引擎性能 3x; 新一代SQL优化器,实现复杂分析语句免调优 • 支持多模分析 通过PostGIS 插件支持0 码力 | 22 页 | 2.98 MB | 1 年前3实现PostgreSQL逻辑复制实战
Postgres Conference China 2016 中国用户大会 数据库总体架构 PostgreSQL 主库 数据库中间件 备1 消息队列 对数据的写操作 PostgreSQL 动态节点管理 … 核心库 查询库 对数据库的读操作 备2 备份 归档 运维监控 数据库总体架构 应用 逻辑复制 2016Postgres中国用户大会 2016Postgres中国用户大会 Postgres Conference China 2016 中国用户大会 SQL语句 数据 MYSQL PG ORACLE LOGICAL Broker M1 M2 M3 Mn Master 逻辑解码 产生SQL+数据 MQ消息队列 DB重放语句 逻辑复制架构图 2016Postgres中国用户大会 Postgres 当使用流复制接口创建一个新的复制槽时, 将会自动产生一个快照。 无DB限制 Pg的逻辑复制可以根据需求把WAL日志直接翻译成 可以直接解析的SQL语句,并通过槽技术向不同DB 进行传递,从而实现不同DB数据库的复制。 2016Postgres中国用户大会 Postgres Conference China 2016 中国用户大会 如何自定义输出插件 我们所要实现以下几个回调函数: L0 码力 | 17 页 | 1.90 MB | 1 年前3postgresql操作手册
systemctl enable postgresql-13 # systemctl start postgresql-13 ★第2章、设置数据存储路径 PostgreSQL 初始化数据库之后, 10版本的默认的数据目录是/var/lib/pgsql/ 13版本的默认的数据目录是/var/lib/pgsql/13/ 现在想修改为/data_pg/ 目录 ★PG-13版本 # systemctl #提示符 => 表示普通账号,=#表示管理员账号 postgres=# #提示符=>前的postgres表示当前数据库名 # psql -h x.x.x.x -p 5432 -U cof -d db_test #使用cof用户登录pg,连接 db_test这个库 db_test=> #提示符=>前的db_test表示当前数据库名 用户信息保存在postgres库下面的名为pg_catalg的schema下的pg_user表里: ★第5章、使用客户端连接 ①命令行客户端连接pg数据库 # psql -h 10.99.1.122 -p 5432 -U postgres #连接pg数据库, # -h指定地址,-p指定端口号,-U指0 码力 | 17 页 | 445.84 KB | 1 年前3PostgreSQL 开发最佳实践
规约的重要性 • 命名规约 • 设计规约 • 管理规约 • 稳定性与性能建议 • 云数据库使用建议 2016Postgres中国用户大会 规约的重要性 2016Postgres中国用户大会 目录 • 规约的重要性 • 命名规约 • 设计规约 • 管理规约 • 稳定性与性能建议 • 云数据库使用建议 2016Postgres中国用户大会 命名规约 • quote_nullable 使用有意义的对象名; 使用小写字母,下划线,数字; 2016Postgres中国用户大会 目录 • 规约的重要性 • 命名规约 • 设计规约 • 管理规约 • 稳定性与性能建议 • 云数据库使用建议 2016Postgres中国用户大会 设计规约 • 返回多行 • select * from tbl where xxx=? order by yyy desc limit 问题(备份、恢复、创建索引、索引深度),分区 2016Postgres中国用户大会 目录 • 规约的重要性 • 命名规约 • 设计规约 • 管理规约 • 稳定性与性能建议 • 云数据库使用建议 2016Postgres中国用户大会 管理规约 • begin; set local lock_timeout = '10s'; -- DDL query; end; • begin;0 码力 | 16 页 | 381.36 KB | 1 年前3PostgreSQL 8.0 Documentation
contrib/dbmirror improvements (Steven Singer) • New contrib/xml2 (John Gray, Torchbox) • Updated contrib/mysql • New version of contrib/btree_gist (Teodor) • New contrib/trgm, trigram matching for PostgreSQL pgcrypto (Marko Kreen) • Prevent crash in xml (John Gray, Michael Richards) • Update oracle • Update mysql • Update cube (Bruno Wolff III) • Update earthdistance to use cube (Bruno Wolff III) • Update btree_gist Allow inet arrays in /contrib/array (Neil) • GiST fixes (Teodor Sigaev, Neil) • Upgrade /contrib/mysql • Add /contrib/dbsize which shows table sizes without vacuum (Peter) • Add /contrib/intagg, integer0 码力 | 1422 页 | 9.92 MB | 1 年前3PostgreSQL 8.0 Documentation
contrib/dbmirror improvements (Steven Singer) • New contrib/xml2 (John Gray, Torchbox) • Updated contrib/mysql • New version of contrib/btree_gist (Teodor) • New contrib/trgm, trigram matching for PostgreSQL pgcrypto (Marko Kreen) • Prevent crash in xml (John Gray, Michael Richards) • Update oracle • Update mysql • Update cube (Bruno Wolff III) • Update earthdistance to use cube (Bruno Wolff III) • Update btree_gist Allow inet arrays in /contrib/array (Neil) • GiST fixes (Teodor Sigaev, Neil) • Upgrade /contrib/mysql • Add /contrib/dbsize which shows table sizes without vacuum (Peter) • Add /contrib/intagg, integer0 码力 | 1332 页 | 9.76 MB | 1 年前3PostgreSQL 8.1.11 Documentation
contrib/dbmirror improvements (Steven Singer) • New contrib/xml2 (John Gray, Torchbox) • Updated contrib/mysql • New version of contrib/btree_gist (Teodor) • New contrib/trgm, trigram matching for PostgreSQL pgcrypto (Marko Kreen) • Prevent crash in xml (John Gray, Michael Richards) • Update oracle • Update mysql • Update cube (Bruno Wolff III) • Update earthdistance to use cube (Bruno Wolff III) • Update btree_gist Allow inet arrays in /contrib/array (Neil) • GiST fixes (Teodor Sigaev, Neil) • Upgrade /contrib/mysql • Add /contrib/dbsize which shows table sizes without vacuum (Peter) • Add /contrib/intagg, integer0 码力 | 1582 页 | 12.19 MB | 1 年前3PostgreSQL 8.1 Documentation
contrib/dbmirror improvements (Steven Singer) • New contrib/xml2 (John Gray, Torchbox) • Updated contrib/mysql • New version of contrib/btree_gist (Teodor) • New contrib/trgm, trigram matching for PostgreSQL pgcrypto (Marko Kreen) • Prevent crash in xml (John Gray, Michael Richards) • Update oracle • Update mysql • Update cube (Bruno Wolff III) • Update earthdistance to use cube (Bruno Wolff III) • Update btree_gist Allow inet arrays in /contrib/array (Neil) • GiST fixes (Teodor Sigaev, Neil) • Upgrade /contrib/mysql 1388 Appendix E. Release Notes • Add /contrib/dbsize which shows table sizes without vacuum (Peter)0 码力 | 1548 页 | 11.54 MB | 1 年前3PostgreSQL 8.2 Documentation
contrib/dbmirror improvements (Steven Singer) • New contrib/xml2 (John Gray, Torchbox) • Updated contrib/mysql • New version of contrib/btree_gist (Teodor) • New contrib/trgm, trigram matching for PostgreSQL pgcrypto (Marko Kreen) • Prevent crash in xml (John Gray, Michael Richards) • Update oracle • Update mysql • Update cube (Bruno Wolff III) • Update earthdistance to use cube (Bruno Wolff III) • Update btree_gist Allow inet arrays in /contrib/array (Neil) • GiST fixes (Teodor Sigaev, Neil) • Upgrade /contrib/mysql • Add /contrib/dbsize which shows table sizes without vacuum (Peter) • Add /contrib/intagg, integer0 码力 | 1762 页 | 5.43 MB | 1 年前3
共 45 条
- 1
- 2
- 3
- 4
- 5