一、 PostgreSQL 的稳定性极强,的确,MySQL 有多种引擎,也确实 Innodb 等引擎在崩溃、断电之类的灾难场景下抗打击能力有了长足进步,但是,很多 MySQL 用户都遇到过Server级的数据库丢失的场景——mysql系统库是MyISAM的……PG数据库15分钟被闪断四次的前D
一、 PostgreSQL 的稳定性极强,的确,MySQL 有多种引擎,也确实 Innodb 等引擎在崩溃、断电之类的灾难场景下抗打击能力有了长足进步,但是,很多 MySQL 用户都遇到过Server级的数据库丢失的场景——mysql系统库是MyISAM的……PG数据库15分钟被闪断四次的前DBA毫无压力的含笑而过。
二、任何系统都有它的性能极限,在高并发读写,负载逼近极限下,PG的性能指标仍可以维持双曲线甚至对数曲线,而
MySQL 明显出现一个波峰后下滑。这些曲线在第三方的测试数据中频繁出现,有兴趣的朋友可以 Google 或自己构建一个测试。
三、在欧美 PG 远没有在中国这么非主流,很多优秀的团队都在用, 主流的开发语言几乎都有 PG 的成熟开发接口,这一点不必有顾虑。像 Python 的 dbapi ,还支持 PG 的异步读写,著名的 SQLAlchemy 对PG的一些特有功能也有支持。
四、PG
多年来在 GIS 领域处于优势地位,因为它有丰富的几何类型,实际上不止几何类型,PG有大量字典、数组、bitmap 等数据类型,通过 SQLAlchemy 这样的工具,可以大大简化开发人员的工作。
五、PG
的“无锁定”特性非常突出,很多 MySQL 需要锁表(也许是在你没有发现的情况下)的操作,PG都可以平滑处理,甚至包括 vacuum 这样的整理数据空间的操作。这就是PG高并发下优异性能的奥秘。
六、PG
的可以使用函数和条件索引,这使得PG数据库的调优非常灵活,而这些功能是经过几十年发展和应用考验的,绝非某个一度反复宣称自己不支持的技术全都是“复杂而无用的”,直到自己支持这些技术为止的数据库产品可以相比的。
七、PG 对于数据分析师有难以抗拒的魅力,它有极其强悍的 SQL 编程能力(9.x 图灵完备,支持递归!),有非常丰富的统计函数和统计语法支持,例如 http://t.cn/zOqiVYc 这里的 window 语法。PG 还可以方便的使用 Python、Perl 甚至任何你喜欢的编程语言写函数。
八、PG
的有多种集群架构可以选择,plproxy 可以支持语句级的镜像或分片,slony 可以进行字段级的同步设置,standby 可以构建WAL文件级或流式的读写分离集群,同步频率和集群策略调整方便,操作非常简单。有年在腾讯广州举办的 barcamp ,我现场演示,一次成功。
九、一般关系型数据库的字符串有限定长度8k左右,无限长
TEXT 类型的功能受限,只能作为外部大数据访问。而 PG 的 TEXT 类型可以直接访问,SQL语法内置正则表达式,可以索引,还可以全文检索,或使用xml xpath。用PG的话,文档数据库都可以省了。
十、PG是BSD类的授权协议,如果你真的对它有足够的兴趣和动力,可以尽情的阅读代码,修改定制。这是出自伯克利校园,历经数十年锤炼的优秀代码,是巨大的宝藏。
==================================================================
最后说一下我感觉 PG 不如 MySQL 的地方。
第一,MySQL有一些实用的运维支持,如 slow-query.log ,这个pg肯定可以定制出来,但是如果可以配置使用就更好了。
第二是mysql的innodb引擎,可以充分优化利用系统所有内存,超大内存下PG对内存使用的不那么充分,
第三是mysql有内存表,这是个被低估的功能。
第四点,MySQL现在允许跳过SQL,在socket上直接调用API,这是个勇敢的尝试,虽然整个社区用的还不多,但是遇到极端场景,需要榨干性能的团队,值得尝试。

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools