英文原文(https://www.digitalocean.com/community/tutorials/sqlite-vs-mysql-vs-postgresql-a-comparison-of-relational-database-management-systems):
SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems
作者:Beginner
Introduction
Relational databases have been in use for a long time. They became popular thanks to management systems that implement the relational model extremely well, which has proven to be a great way to work with data [especially for mission-critical applications].
In this DigitalOcean article, we are going to try to understand the core differences of some of the most commonly used and popular relational database management systems (RDBMS). We will explore their fundamental differences in terms of features and functionality, how they work, and when one excels over the other in order to help developers with choosing a RDBMS.
Glossary
1. Database Management Systems
1 Relational Database Management Systems
2 Relations And Data Types
3 Popular And Important Relational Databases
2. SQLite
4 SQLite's Supported Data Types
5 Advantages of SQLite
6 Disadvantages of SQLite
7 When To Use SQLite
8 When Not To Use SQLite
3. MySQL
9 MySQL's Supported Data Types
10 Advantages of MySQL
11 Disadvantages of MySQL
12 When To Use MySQL
13 When Not To Use MySQL
4. PostgreSQL
14 PostgreSQL's Supported Data Types
15 Advantages of PostgreSQL
16 Disadvantages of PostgreSQL
17 When To Use PostgreSQL
18 When Not To Use PostgreSQL
Database Management Systems
Databases are logically modelled storage spaces for all kinds of different information (data). Each database, other than schema-less ones, have a model, which provide structure for the data being dealt with. Database management systems are applications (or libraries) which manage databases of various shapes, sizes, and sorts.
Relational Database Management Systems
Relational Database Systems implement the relational model to work with the data. Relational model shapes whatever information to be stored by defining them as related entities with attributes across tables (i.e. schemas).
These type of database management systems require structures (e.g. a table) to be defined in order to contain and work with the data. With tables, each column (e.g. attribute) holds a different type (e.g. data type) of information. Each record in the database, uniquely identified with keys, translates to a row that belongs to a table, with each row's series of attributes being represented as the columns of a table -- all related together, as defined within the relational model.
Relations And Data Types
Relations can be considered as mathematical sets that contain series of attributes which collectively represent the database and information being kept. This type of identification and collection method allow relational databases to work the way they do.
When defining a table to insert records, each element forming a record (i.e. attribute) must match the defined data type (e.g. an integer, a date etc.). Different relational database management systems implement different data types -- which are not always directly interchangeable.
Working with and through constraints, like the one we have just explained, is common with relational databases. In fact, constraints form the core of the relations.
Popular And Important Relational Databases
In this article, we are going to introduce three major and important open-source relational database management systems that have helped to shape the world of application development.
· SQLite:
A very powerful, embedded relational database management system.
· MySQL:
The most popular and commonly used RDBMS.
· PostgreSQL:
The most advanced, SQL-compliant and open-source objective-RDBMS.
SQLite
SQLite is an amazing library that gets embedded inside the application that makes use of. As a self-contained, file-based database, SQLite offers an amazing set of tools to handle all sorts of data with much less constraint and ease compared to hosted, process based (server) relational databases.
When an application uses SQLite, the integration works with functional and direct calls made to a file holding the data (i.e. SQLite database) instead of communicating through an interface of sorts (i.e. ports, sockets). This makes SQLite extremely fast and efficient, and also powerful thanks to the library's underlying technology.
SQLite's Supported Data Types
· NULL:
NULL value.
· INTEGER:
Signed integer, stored in 1, 2, 3, 4, 6, or 8 bytes depending on the magnitude of the value.
· REAL:
Floating point value, stored as an 8-byte IEEE floating point number.
· TEXT:
Text string, stored using the database encoding (UTF-8, UTF-16BE or UTF-16LE).
· BLOB:
A blob of data, stored exactly as it was input.
Advantages of SQLite
· File based:
The entire database consists of a single file on the disk, which makes it extremely portable.
· Standards-aware:
Although it might appear like a "simple" DB implementation, SQLite uses SQL. It has some features omitted (RIGHT OUTER JOIN or FOR EACH STATEMENT), however, some additional ones are baked in.
· Great for developing and even testing:
During the development phase of most applications, for a majority of people it is extremely likely to need a solution that can scale for concurrency. SQLite, with its rich feature base, can offer more than what is needed for development with the simplicity of working with a single file and a linked C based library.
Disadvantages of SQLite
· No user management:
Advanced databases come with the support for users, i.e. managed connections with set access privileges to the database and tables. Given the purpose and nature of SQLite (no higher-levels of multi-client concurrency), this feature does not exist.
· Lack of possibility to tinker with for additional performance:
Again by design, SQLite is not possible to tinker with to obtain a great deal of additional performance. The library is simple to tune and simple to use. Since it is not complicated, it is technically not possible to make it more performant than it already, amazingly is.
When To Use SQLite
· Embedded applications:
All applications that need portability, that do not require expansion, e.g. single-user local applications, mobile applications or games.
· Disk access replacement:
In many cases, applications that need to read/write files to disk directly can benefit from switching to SQLite for additional functionality and simplicity that comes from using the Structured Query Language (SQL).
· Testing:
It is an overkill for a large portion of applications to use an additional process for testing the business-logic (i.e. the application's main purpose: functionality).
When Not To Use SQLite
· Multi-user applications:
If you are working on an application whereby multiple clients need to access and use the same database, a fully-featured RDBM (e.g. MySQL) is probably better to choose over SQLite.
· Applications requiring high write volumes:
One of the limitations of SQLite is the write operations. This DBMS allows only one single write*operating to take place at any given time, hence allowing a limited throughput.
MySQL
MySQL is the most popular one of all the large-scale database servers. It is a feature rich, open-source product that powers a lot of web-sites and applications online. Getting started with MySQL is relatively easy and developers have access to a massive array of information regarding the database on the internet.
MySQL's Supported Data Types
· TINYINT:
A very small integer.
· SMALLINT:
A small integer.
· MEDIUMINT:
A medium-size integer.
· INT or INTEGER:
A normal-size integer.
· BIGINT:
A large integer.
· FLOAT:
A small (single-precision) floating-point number. Cannot be unsigned.
· DOUBLE, DOUBLE PRECISION, REAL:
A normal-size (double-precision) floating-point number. Cannot be unsigned.
· DECIMAL, NUMERIC:
An unpacked floating-point number. Cannot be unsigned.
· DATE:
A date.
· DATETIME:
A date and time combination.
· TIMESTAMP:
A timestamp.
· TIME:
A time.
· YEAR:
A year in 2- or 4- digit formats (default is 4-digit).
· CHAR:
A fixed-length string that is always right-padded with spaces to the specified length when stored.
· VARCHAR:
A variable-length string.
· TINYBLOB, TINYTEXT:
A BLOB or TEXT column with a maximum length of 255 (2^8 - 1) characters.
· BLOB, TEXT:
A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1) characters.
· MEDIUMBLOB, MEDIUMTEXT:
A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1) characters.
· LONGBLOB, LONGTEXT:
A BLOB or TEXT column with a maximum length of 4294967295 (2^32 - 1) characters.
· ENUM:
An enumeration.
· SET:
A set.
Advantages of MySQL
· Easy to work with:
MySQL can be installed very easily. Third-party tools, including visual ones (i.e. GUIs) make it extremely simple to get started with the database.
· Feature rich:
MySQL supports a lot of the SQL functionality that is expected from a RDBMS -- either directly or indirectly.
· Secure:
A lot of security features, some rather advanced, are built in MySQL.
· Scalable and powerful:
MySQL can handle a lot of data and furthermore it can be used "at scale", if needed be.
· Speedy:
Giving up some standards allows MySQL to work very efficiently and cut corners, thus providing speed gains.
Disadvantages of MySQL
· Known limitations:
By design, MySQL does not intend to do everything and it comes with functional limitations that some state-of-the-art applications might require.
· Reliability issues:
The way certain functionality gets handled with MySQL (e.g. references, transactions, auditing etc.) renders it a little-less reliable compared to some other RDBMSs.
· Stagnated development:
Although MySQL is still technical an open-source product, there are complaints regarding the development process since its acquisition. However, it should be noted that there are some MySQL-based, fully-integrated databases that add value on top of the standard MySQL installations (e.g. MariaDB).
When To Use MySQL
· Distributed operations:
When you need more than what SQLite can offer, including MySQL to your deployment stack, just like any stand-alone database server, brings a lot of operational freedom together with some advanced features.
· High security:
MySQL's security features provide reliable protection for data-access (and use) in a simple way.
· Web-sites and web-applications:
A great majority of web-sites (and web-applications) can simply work on MySQL despite the constraints. This flexible and somewhat scalable tool is easy to use and easy to manage -- which proves very helpful in the long run.
· Custom solutions:
If you are working on a highly specific and extremely custom solution, MySQL can tag along easily and go by your rules thanks to its rich configuration settings and operation modes.
When Not To Use MySQL
· SQL compliance:
Since MySQL does not [try to] implement the full SQL standard, this tool is not completely SQL compliant. If you might need integration with such RDBMSs, switching from MySQL will not be easy.
· Concurrency:
Even though MySQL and some storage engines perform really well with readoperations, concurrent read-writes can be problematic.
· Lack of features:
Again, depending on the choice of the database-engine, MySQL can lack certain features, such as the full-text search.
PostgreSQL
PostgreSQL is the advanced, open-source [object]-relational database management system which has the main goal of being standards-compliant and extensible. PostgreSQL, or Postgres, tries to adopt the ANSI/ISO SQL standards together with the revisions.
Compared to other RDBMSs, PostgreSQL differs itself with its support for highly required and integral object-oriented and/or relational database functionality, such as the complete support for reliable transactions, i.e. Atomicity, Consistency, Isolation, Durability (ACID).
Due to the powerful underlying technology, Postgres is extremely capable of handling many tasks very efficiently. Support for concurrency is achieved without read locks thanks to the implementation of Multiversion Concurrency Control (MVCC), which also ensures the ACID compliance.
PostgreSQL is highly programmable, and therefore extendible, with custom procedures that are called "stored procedures". These functions can be created to simplify the execution of repeated, complex and often required database operations.
Although this DBMS does not have the popularity of MySQL, there are many amazing third-party tools and libraries that are designed to make working with PostgreSQL simple, despite this database's powerful nature. Nowadays it is possible to get PostgreSQL as an application package through many operating-system's default package manager with ease.
PostgreSQL's Supported Data Types
· bigint:
signed eight-byte integer
· bigserial:
autoincrementing eight-byte integer
· bit [(n)]:
fixed-length bit string
· bit varying [(n)]:
variable-length bit string
· boolean:
logical Boolean (true/false)
· box:
rectangular box on a plane
· bytea:
binary data ("byte array")
· character varying [(n)]:
variable-length character string
· character [(n)]:
fixed-length character string
· cidr:
IPv4 or IPv6 network address
· circle:
circle on a plane
· date:
calendar date (year, month, day)
· double precision:
double precision floating-point number (8 bytes)
· inet:
IPv4 or IPv6 host address
· integer:
signed four-byte integer
· interval [fields] [(p)]:
time span
· line:
infinite line on a plane
· lseg:
line segment on a plane
· macaddr:
MAC (Media Access Control) address
· money:
currency amount
· numeric [(p, s)]:
exact numeric of selectable precision
· path:
geometric path on a plane
· point:
geometric point on a plane
· polygon:
closed geometric path on a plane
· real:
single precision floating-point number (4 bytes)
· smallint:
signed two-byte integer
· serial:
autoincrementing four-byte integer
· text:
variable-length character string
· time [(p)] [without time zone]:
time of day (no time zone)
· time [(p)] with time zone:
time of day, including time zone
· timestamp [(p)] [without time zone]:
date and time (no time zone)
· timestamp [(p)] with time zone:
date and time, including time zone
· tsquery:
text search query
· tsvector:
text search document
· txid_snapshot:
user-level transaction ID snapshot
· uuid:
universally unique identifier
· xml:
XML data
Advantages of PostgreSQL
· An open-source SQL standard compliant RDBMS:
PostgreSQL is open-source and free, yet a very powerful relational database management system.
· Strong community:
PostgreSQL is supported by a devoted and experienced community which can be accessed through knowledge-bases and Q&A sites 24/7 for free.
· Strong third-party support:
Regardless of the extremely advanced features, PostgreSQL is adorned with many great and open-source third-party tools for designing, managing and using the management system.
· Extensible:
It is possible to extend PostgreSQL programmatically with stored procedures, like an advanced RDBMS should be.
· Objective:
PostgreSQL is not just a relational database management system but an objective one - with support for nesting, and more.
Disadvantages of PostgreSQL
· Performance:
For simple read-heavy operations, PostgreSQL can be an over-kill and might appear less performant than the counterparts, such as MySQL.
· Popularity:
Given the nature of this tool, it lacks behind in terms of popularity, despite the very large amount of deployments - which might affect how easy it might be possible to get support.
· Hosting:
Due to above mentioned factors, it is harder to come by hosts or service providers that offer managed PostgreSQL instances.
When To Use PostgreSQL
· Data integrity:
When reliability and data integrity are an absolute necessity without excuses, PostgreSQL is the better choice.
· Complex, custom procedures:
If you require your database to perform custom procedures, PostgreSQL, being extensible, is the better choice.
· Integration:
In the future, if there is a chance of necessity arising for migrating the entire database system to a propriety (e.g. Oracle) solution, PostgreSQL will be the most compliant and easy to handle base for the switch.
· Complex designs:
Compared to other open-source and free RDBMS implementations, for complex database designs, PostgreSQL offers the most in terms of functionality and possibilities without giving up on other valuable assets.
When Not To Use PostgreSQL
· Speed:
If all you require is fast read operations, PostgreSQL is not the tool to go for.
· Simple set ups:
Unless you require absolute data integrity, ACID compliance or complex designs, PostgreSQL can be an over-kill for simple set-ups.
· Replication:
Unless you are willing to spend the time, energy and resources, achieving replication with MySQL might be simpler for those who lack the database and system administration experience.
中文翻译(请原谅我的渣翻译,翻译了这么多最后却不用交,特此贴出来):SQLite vs MySQL vs PostgreSQL:关系型数据库管理系统的比较
作者:Beginner
简介
关系型数据库已经使用了很长一段时间。他们走红得益于极为出色的实现了关系模式的管理系统,这也被证明是一种跟数据一起运转的伟大方式【特别适用于关键任务应用程序】。
在这篇DigitalOcean文章中,我们要试着去了解一些最常用和流行的关系数据库管理系统(RDBMS)的核心差异。我们将根据特性和功能,它们是如何工作,和什么时候一个优胜于另一个来探索要他们根本性的差异来帮助开发者选择一个RDBMS。、
数据库管理系统
数据库是为各种不同信息(或数据)而准备的被逻辑模型化的存储空间。每个数据库,相对于架构少的数据,有一个为正在处理的数据提供结构的模型。数据库管理系统是管理各种形状,大小和各种数据库的应用程序(或库)。
关系数据库管理系统
关系数据库系统实现了与数据一同运行的关系模型。关系模型的形态不在于通过定义它们作为相关实体与属性的跨表(即模式)的存储信息。
这些类型的数据库管理系统都需要被定义的结构(如一张表)来包含和使用数据。在使用表的情况下,每列(如属性)包含不同类型的信息(如数据类型)。在数据库中的每条记录,键的唯一标识,转化为属于一个表中的一行,每行的系列被表示为一个表的列属性- 所有相关在一起,作为关系模型中的定义。
关系和数据类型
关系可以被视为包含一系列表示数据库和被保持的信息的属性的数学集。这种类型的标识和集合方式允许关系型数据库如它们运行的那样运行。
当向定义中的一个表插入记录,成一个记录(即属性)的每个元素必须与定义的数据类型(如整数,日期等)相匹配。不同的关系数据库管理系统实现不同的数据类型- 这并不总是直接互换。
通过和伴随着约束工作,就像我们刚才解释,在关系数据库中很常见。实际上,约束形成了关系的核心。
流行的和重要的关系型数据库
在这篇文章中,我们将介绍三种主要的和重要的开放源码的并且已经帮助塑造了应用开发的世界的关系型数据库管理系统。
SQLite的:
一个非常强大的嵌入式关系数据库管理系统。
MySQL的:
最流行和常用的RDBMS。
PostgreSQL的:
最先进的,兼容SQL和开源的客观RDBMS。
SQLite
SQLite是一个被用来嵌入应用程序中的了不起的库。作为一个独立的,基于文件的数据库,SQLite提供了一个惊人的工具集来处理所有类型的数据而伴随少得多的约束和相比于主机,基于进程(服务器)的关系数据库性能的缓解。
当一个应用程序使用SQLite时,集成的工作原理和直接的调用而不是通过各种各样的接口(即端口,套接字)让一个文件包含数据(即SQLite数据库)。多亏库的底层技术,这才使得SQLite极其快速、高效和强大。
SQLite支持的数据类型
NULL:
NULL值。
INTEGER:
有标记的整数,存储在1,2,3,4,6,或8字节中,这取决于该值的大小。
REAL:
浮点值,作为一个8字节IEEE浮点数存储。
TEXT:
文本字符串,使用数据库编码(UTF-8,UTF-16BE或UTF-16LE)储存。
BLOB:
一个BLOB数据,存储它所输入的。
SQLite的优点
基于文件:
在磁盘上整个数据库只包含一个文件,这使得它非常的轻便。
标准意识:
尽管它可能看起来像一个“简单”的数据库实现,SQLite却依然使用的SQL。它有一些功能被忽略(RIGHT OUTER JOIN或FOR EACH STATEMENT),然而,一些额外的功能却被加入。
在大开发,甚至是测试:
在大多数应用程序的开发阶段,对于大多数人来说是极有可能需要一个可扩展的并发性的解决方案。以其丰富的特征为基础的 SQLite可以以单个文件和基于库的C连接来提供超过简单开发时所需要的要求。
SQLite的缺点
没有用户管理:
先进的数据库伴随着用户支持,即对数据库和表连接的管理与设置访问权限的支持。考虑到目的和SQLite的特性(没有更高层次的多客户端并发),这种功能并不存在。
缺乏额外性能修改的可能性:
由于再次设计,SQLite是不可能修改来获得巨大的额外性能。它的库很简单就可以调整并且简单易用。由于它并不复杂,它在技术上没有可能使它像它以前让人惊讶的获得更多的性能。
什么时候使用SQLite
嵌入式应用:
需要便携性的所有应用程序,它们不需要扩大,如单用户的本地应用程序,移动应用程序或游戏。
可以更换的磁盘:
在许多情况下,需要直接读取/写入文件到硬盘的应用程序可以从直接切换到SQLite而获得更多的额外的性能和简单的使用结构化查询语言(SQL)来查询中受益。
测试:
这对于应用程序的一大部分来使用一个额外的进程来测试业务逻辑(即应用程序的主要目的:功能性)是矫枉过正的。
什么时候不使用SQLite
多用户应用程序:
如果您正运行一个多个客户端需要访问并使用相同的数据库的应用程序一个全功能的RDBM(如MySQL的)可能是更好的选择而不是SQLite。
需要大量写入的应用:
SQLite的一个局限性是写操作。这个数据库管理系统只允许一个单一写操作执行在任何给定的时间,从而使得吞吐量有限。
MySQL
MySQL是所有大型数据库服务器中最流行的一种。它是一个功能丰富,支持许多网站和在线应用的开源产品。 MySQL入门相对容易,开发人员可以通过在网路上的数据库来访问巨大的信息。
MySQL支持的数据类型
TINYINT :
一个非常小的整数。
SMALLINT :
一个小整数。
MEDIUMINT :
一个中等大小的整数。
INT 或INTEGER :
一个正常大小的整数。
BIGINT :
大整数。
FLOAT :
一个小(单精度)浮点数字。不能无符号。
DOUBLE, DOUBLE PRECISION , REAL :
一个正常大小(双精度)浮点数字。不能无符号。
DECIMAL, NUMERIC:
没有包装的浮点数。不能无符号。
DATE:
一个日期。
DATETIME :
日期和时间的组合。
TIMESTAMP :
时间戳。
TIME:
一个时间。
YEAR:
以2_或4_为格式的年份(默认为4_格式)。
CHAR :
固定长度的字符串,它存储的时候靠左使用空格填充的。
VARCHAR :
可变长度的字符串。
TINYBLOB , TINYTEXT :
一个BLOB或TEXT列255 ( 2 ^ 8 - 1)最大长度字符。
BLOB , TEXT :
一个BLOB或TEXT列65535 ( 2 ^ 16 - 1)最大长度字符。
MEDIUMBLOB , MEDIUMTEXT :
一个BLOB或TEXT列16777215 ( 2 ^ 24 - 1)最大长度字符。
LONGBLOB , LONGTEXT :
一个BLOB或TEXT列4294967295 ( 2 ^ 32 - 1)最大长度字符。
ENUM :
枚举。
SET :
列表。
MySQL的优势
易于使用:
MySQL能够很容易地进行安装。第三方工具,包括视觉的(即图形用户界面),使之变成极其简单上手的数据库。
功能丰富:
MySQL支持从一个RDBMS所预期的大量的SQL功能 - 无论是直接或间接的。
安全:
很多安全功能,一些甚至比较先进的,是建立在MySQL。
可扩展性和强大的:
MySQL能够处理大量的数据,而且它可以“规模化”,如果在需要的时候。
快捷:
放弃一些标准允许MySQL非常高效捷径地工作,从而提供快速的收益。
MySQL的缺点
已知的限制:
按照设计,MySQL不打算做的一切,它有一些可能其他稳定应用可能会需要的功能限制。
可靠性问题:
相比一些其他RDBMS,MySQL使用特定功能(例如参考,回滚,审计等)的处理方式,使得它有一点点不太可靠。
停滞不前的发展:
尽管MySQL仍然还是技术上开源的一个产品,但是在开发过程由于获得数据的方式仍然存在则很多抱怨。但是,应该指出的是,也有一些基于MySQL的,即加在标准的MySQL安装(如MariaDB的)的最高的完全集成的数据库。
什么时候使用MySQL
分布式操作:
当你需要超过SQLite可以提供的时候,包括MySQL作为您的部署堆栈,就像任何独立的数据库服务器,带来了很多的操作自由度以及一些高级功能。
高安全性:
MySQL的安全功能以简单的方式提供数据访问(和使用)的可靠的保护。
网站和网络应用程序:
尽管有一些限制,大多数web站点(和网络应用程序)可以简单地工作在MySQL。这种灵活的和可扩展的工具是易于使用和易于管理- 从长远来看这证明非常有帮助。
定制解决方案:
如果你需要一个非常具体的和严格定制的解决方案,得益于其丰富的配置设置和操作模式,MySQL可以很容易地附属和适应你的规则。
什么时候不使用MySQL
SQL遵从性:
由于MySQL并不是实现完整的SQL标准,所以这个工具并不是完全兼容SQL。如果你可能需要将这样的关系数据库管理系统进行整合,从MySQL切换将不会很容易。
并发性:
尽管MySQL和一些存储引擎在读操作性上表现很好用,但在并发读写操作可能会产生问题。
缺少功能:
再次,这取决于数据库引擎的选择,MySQL能够缺少某些功能,如全文检索。
PostgreSQL
PostgreSQL是先进的,开放源码的对象- 关系型数据库管理系统,它作为符合标准的,可扩展的主要目标。 PostgreSQL或Postgres,尝试采用ANSI / ISO SQL标准结合起来进行修改。
相较于其他RDBMS时,PostgreSQL本身的不同,其支持非常必要和不可或缺的面向对象和/或关系型数据库功能,如可靠的交易,即原子性,一致性,隔离性和持久性(ACID)的完整支持。
由于强大的底层技术,Postgres处理多任务能力极其有效地。得益于多版本并发控制(MVCC)而取得了实施并发不读锁,这也保证ACID。
PostgreSQL是高度可编程的,因此在被称为“存储过程”的自定义程序中可扩展。这些功能被创建来简化重复的,复杂的,经常请求的的数据库操作。
虽然这个DBMS没有MySQL的普及,但是仍有许杰出的旨在使PostgreSQL简单工作的第三方工具和库,尽管该数据库强大的本性。现在有可能轻松通过许多操作系统的默认软件包管理器得到作为一个应用程序包的PostgreSQL。
PostgreSQL支持的数据类型
BIGINT:
有符号8字节整数
BIGSERIAL:
自增八字节整数
bit[(n)]:
固定长度的位串
bit varying[(n)]:
可变长度的比特串
boolean:
逻辑布尔(真/假)
box:
在一个平面上的矩形框
bytea:
二进制数据( “字节数组” )
character varying [(n)]:
可变长度的字符串
character [(n)]:
固定长度的字符串
CIDR:
IPv4或IPv6网络地址
cidr:
在一个平面上的圆
date:
日历日期(年,月,日)
double precision:
双精度浮点数( 8字节)
inet:
IPv4或IPv6主机地址
integer:
标识四个字节的整数
interval [fields] [(p)]:
时间跨度
line:
在一个平面上无限长的直线
lesg:
在一个平面上的线段
macaddr:
MAC(媒体访问控制)地址
money:
货币金额
numeric [(p, s)]:
可选精度精确数字
path:
在一个平面上的几何路径
point:
在一个平面上的几何点
polygon:
在平面上封闭的几何路径
real:
单精度浮点数(4字节)
smallint:
签署了两个字节的整数
serial:
自增四字节的整数
text:
可变长度的字符串
time [(p)] [without time zone]:
一天中的时间(无时区)
time [(p)] with time zone:
一天的时间,包括时区
timestamp [(p)] [without time zone]:
日期和时间(无时区)
timestamp [(p)] with time zone:
日期和时间,包括时区
tsquery:
文本搜索查询
tsvector:
文本搜索文档
txid_snapshot:
用户级别的事务ID快照
uuid:
通用唯一标识符
xml:
xml数据
PostgreSQL的优势
一个开源的SQL标准兼容的RDBMS:
PostgreSQL是开源和免费的,但一个非常强大的关系数据库管理系统。
强大的社区:
PostgreSQL是由一个专门的和有经验的,可通过知识基础和Q&A网站24/7免费访问社区所支持。
强大的第三方支持:
忽略极其先进的功能,PostgreSQL是由许多伟大的和开源的第三方工具优化与设计,管理和使用的管理系统。
可扩展性:
它可以以编程方式扩展PostgreSQL的存储过程,正如一个先进的RDBMS应该的那样。
客观:
PostgreSQL不仅仅只是一个关系型数据库管理系统,更是客观的— 支持嵌套和更多。
PostgreSQL的缺点
性能:
对于简单的读重操作,PostgreSQL可能会执行过度,性能相较同行可能不如,如MySQL。
人气:
鉴于这种工具的性质,它缺乏背后的普及,尽管有非常大量的部署- 这可能会影响得到支撑的容易程度。
主机:
由于上述因素的影响,这是很难得的主机或服务供应商,提供管理PostgreSQL的实例。
什么时候使用PostgreSQL
数据完整性:
数据的可靠性和完整性是必需和没有借口的,PostgreSQL是更好的选择。
复杂的自定义过程:
如果你需要你的数据库执行自定义程序,可扩展的PostgreSQL,是更好的选择。
集成:
在未来,如果有必要产生整个数据库系统迁移到一个恰当(如Oracle)解决方案的时候,PostgreSQL将是最标准的,易于处理的来迁移。
复杂的设计:
相比于其他开源和免费的RDBMS实现,对于复杂的数据库设计,PostgreSQL提供长远的功能和可能性而没有放弃他们自身价值的
什么时候不使用PostgreSQL
速度:
如果你需要全部是快速读取操作,PostgreSQL将不是你的理想工具。
简单的设置:
除非你要求绝对的数据完整性,ACID兼容性或复杂的设计,PostgreSQL可能会在简单的设置上过犹不及。
复制:
除非你愿意花时间,精力和资源,用MySQL实现复制可能对于那些缺乏数据库和系统管理经验的人更加简单。