search
HomeDatabaseMysql TutorialPostgre SQL 数据库将迎来崛起时刻

Postgre s 正获得越来越多的关注 - 理所应当的。像 Postgre s 这样开放的数据库系统正在和大型、昂贵、不规则的“企业级”系统,例如 SQL Server,Oracle 形成正面的交锋,提供同等的功能,但更好用。在所有这些系统中, Postgre s 是最智能,最快速和功能最


    Postgres 正获得越来越多的关注 - 理所应当的。像 Postgres 这样开放的数据库系统正在和大型、昂贵、不规则的“企业级”系统,例如 SQLServer,Oracle 形成正面的交锋,提供同等的功能,但更好用。在所有这些系统中,Postgres 是最智能,最快速和功能最全面的。


    Postgres.app


    最近有一些关于 Postgres.app 的风言风语。大部分人不理解 Postgres.app,我来简单解释一下吧。


    Postgres 可以配置很多有趣的选项,例如运行地球空间信息索引(PostGIS),创建 Ruby 和 JavaScript 方法,扩展查询引擎以支持远程数据例如 GMail.这些功能都需要从源代码编译,这是一个比较痛苦的过程,即使你在 Mac 上使用 Homebrew.


    Homebrew 根据常用的配置抓取源码并编译。Postgres.app 是预先编译好,并且作为一个守护进程运行。你可以根据需要打开或者关闭。你只需要下载它,拖动到你的应用目录就搞定了。


    对比一下 SQL Server 和 Oracle 的安装过程吧!


    这明显要迷人很多。如果你使用的是 Mac,你还可以使用 Navicat.有一个免费的版本,你也可以先玩一下他们的demo.


    重新认识一下这位老朋友


    PostgreSQL 已经存在了很长时间了。你看到这里也许在想这操蛋的名字到底是谁取的?Tom Lane 的解释如下:


    软件的名字是 PostgreSQL 或者 Postgres,不是 Postgre……的确,1996年决定叫它PostgreSQL 而不是更简单的 Postgres 应该是这个项目到目前为止犯的唯一一个错误。但现在想改已经太晚。


    Postgres 是从一个非常古老的数据库系统 Ingres 移植而来,目的是创建一个可插拔的,可伸缩的快速数据库系统,并且是用户友好而智能。“Postgres”这个名字似乎是在影射之前的项目“After Ingres”.


    谁在乎呢?


    这一点很关键 - 不是很多人。随着 PHP 的兴起,“更友好”的 MySQL 平台被广泛的采用,而不是更严谨,基于规则的 Postgres 系统。“更友好”在我看来是“更愚蠢”.


    好吧,我承认我的话很伤人,我收回。这一段视频是我在 Tekpub 上发布的,名字叫做“MySQL 的危险”.假如你不想看完整段视频(译者注:天朝的我们没法看),我来做一个总结:


    MySQL 可能会忽略你的默认值或者限制,为了“帮助你”不要太严谨


    假如字段不能为空的话,它不能向非空字段插入 “”


    假如字段不能为空的话,它会插入无意义的日期例如“0000-00-00”


    1/0 返回的是 NULL


    “THIS IS NOT A NUMBER”/0 返回的是 NULL


    假如你向一个长度限制为2的字段插入1000的话,它会帮你四舍五入成99


    这些就是你要小心使用 MySQL 的地方。它默认不会保护你的数据,而是以牺牲数据完整性来尝试让你通过。这在我看来很愚蠢。


    如果这些你都不在乎的话,我还有一个词要送给你:Oracle.


    快速,可扩展,有趣


    Postgres 有很多的功能,大部分人可能都不知道。它有很多句法上的技巧:


    关键词“Infinity”意味着比任何输入的数字要大。这可以是数字,也可以是日期,也可以设置正负。


    可以识别“today”,“tomorrow”,“yesterday”等关键词


    令人惊讶的数据类型,例如 Arrays,IP地址(支持 IPv6)。还有空间类型,例如线,正方形,圆形


    数据表继承,这是一个很奇怪的功能,可以让你的一张表继承另外一张表


    自带自然语言全文索引


    更重要的是 Postgres 还非常的快速并且可扩展。我和我的 DBA 朋友 Rob Sullivan 做了一些测试,装载 StackOverflow 600万条的文本数据。我们用的是 Windows 的机器,在很多情况下 Postgres 秒杀了 SQL Server.


    虽然 SQL Server 也可以为数据表分区,但是你必须付费,更何况 Postgres 的性能更好,并且索引更小。


    如果这些还不够的话,Postgres 默认支持 TOAST 数据表。这个名字很奇怪,是“Automatic Table Compression”的缩写。我在本文最后的 demo 中展示了这一点。还有,Postgres 会在你的磁盘上压缩数据,减少 RAM 和磁盘的使用量。


    这个功能使得 StackOverflow 的 dump 数据从24G降到了6G!记住这些都是Postgres免费提供的,而使用 SQL Server 你就必须购买企业授权。


    还有五件你不知道的事情


    关于 Postgres 还有很多可以写,我还是想贴一下我在 NDC 2012 上的演讲 “5 Things You Didn't Know About PostgreSQL”:


    通过 Foreign Data Wrappers 进行 Twitter 查询


    使用 Google 的 V8 引擎编写 JavaScript 函数


    秒杀 MySQL 的那些雕虫小技


    避免锁以及自带的快照功能


    数据表继承


    疯狂的数据类型


    希望你会喜欢。

声明:凡注明CIO时代网(www.ciotimes.comwww.ciotimes.com),违者本网将依法追究责任。


转至http://www.ciotimes.com/infrastructure/sjk/68116.html

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

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.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

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.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

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: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

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: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

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: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

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.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

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.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

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

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment