How MySQL and PostgreSQL choose?

MySQL and PostgreSQL compare what the election

In order to understand the difference between PostgreSQL and MySQL, I searched keyword: MySQL vs PostgreSQL, and read a few articles on the first page. The following is a brief summary:

MySQL and PostgreSQL difference
MySQL application developers to create out of the DBMS; and PostgreSQL is a database created by the developer out of the DBMS.
In other words, MySQL tends user's perspective, to answer the question "Do you want to solve a problem"; while PostgreSQL tend theoretical point of view, to answer the question "how database to solve the problem."

MySQL general will verify the legitimacy of data to the customer; PostgreSQL difficult in terms of the legality of doing more stringent. For example, in MySQL Insert "2012-02-30" when this time will be successful, but the result will be "0000-00-00"; PostgreSQL does not allow insertion of this value.

Generally, PostgreSQL is considered feature-rich, and MySQL are considered faster. But this view is the basic thing in MySQL 4.x / PostgreSQL 7.x, and now the situation has changed, PostgreSQL 9.x versions on speed has been greatly improved, and the characteristics of MySQL are also increasing.

In architecture, MySQL divided into two layers: the upper layer and several SQL storage engine (such as InnoDB, MyISAM). PostgreSQL only one storage engine provides two functions.

The two database systems can be optimized for contextual applications, customized, accurate difficult to say which is better performance. MySQL start of the project will focus on speed, while PostgreSQL initially focus on the characteristics and specifications.
Which to choose?

It may be due to historical reasons MySQL among developers more popular. When we go to school at least heard of PostgreSQL, MS SQL Server is not the time MySQL, but MySQL is open source. Practical work until PostgreSQL 8.0 before the official support of the Windows system.

If there is no historical reason (such as MySQL-based system has been for years), or the accumulation of technical reasons (multi-master MySQL colleagues), then I think your choice of PostgreSQL can do no wrong.

Interestingly, I searched "switch postgresql to mysql" on Google, the results in the first page of all "Switch to PostgreSQL from MySQL", finally there is a second page is from PostgreSQL to MySQL, but it is only one, and PostgreSQL reason not to say that bad, but because more and more of MySQL experience.

1. problem
if you plan for the project to choose a free, open-source database, then you might be wavering between MySQL and PostgreSQL. MySQL and PostgreSQL are free, open source, powerful, and feature-rich database. Your main problem might be: Which is the best open source database, MySQL or PostgreSQL it? The choice of which an open source database?

In selecting the database, you have done is a long-term decision-making, because if we later decide to change would be very difficult and costly. You want to choose the right start. Two popular open source database MySQL and PostgreSQL often the last to be selected products. These two high-level overview of open source database will help you choose the most suited to their needs.

2, MySQL
MySQL is relatively young, first appeared in 1994. It claims to be the most popular open source database. MySQL is the LAMP (software packages for Web developers, including Linux, Apache and Perl / PHP / Python) in M. Built on the LAMP stack for most applications will use MySQL, including those of well-known applications, such as WordPress, Drupal, Zend and phpBB etc.

A beginning, MySQL design goal is to become a fast back-end Web server, using fast indexed sequential access method (ISAM), do not support ACID. After rapid growth early, MySQL storage engine began to support more and implements ACID by InnoDB engine. MySQL also supports other storage engines, provides the functionality temporary table (using MEMORY storage engine) to achieve high-speed read through the MyISAM database engine, in addition to other core engine with third-party storage engine.

MySQL documentation is very rich, there are many good quality free reference manuals, books and documents, as well as from third-party vendors Oracle and training and support.

MySQL in recent years has undergone a change of ownership and a number of dramatic events. It was originally developed by MySQL AB, then in 2008 at a price of $ 1 billion sold to Sun Microsystems, the Sun has been acquired by Oracle in 2010. Oracle's MySQL support multiple versions: Standard, Enterprise, Classic, Cluster, Embedded and Community. Some of which are free to download, while others for a fee. The core code is under the GPL license, for those who do not want to use GPL-licensed developers and vendors, as well as commercial licenses are available.

Now, choose the code based on the original MySQL database and many more, because few core MySQL developers have released a MySQL branch. The original MySQL creator of one of Michael "Monty" Widenius seemingly regretted MySQL sold to Sun, so he developed his own MySQL branch MariaDB, it's free, GPL-based license. Well-known developer of MySQL branch Drizzle Brian Aker created a lot of rewriting it, especially for multi-CPU, cloud, network applications and highly concurrent optimized.

3.PostgreSQL
PostgreSQL advertises itself as the world's most advanced open source database. Some fans say it's comparable to PostgreSQL and Oracle, but not so high price and arrogant customer service. It has a long history, first in 1985 at the University of California at Berkeley, as a successor to Ingres database.

PostgreSQL is entirely community-driven open source project by more than 1000 contributors worldwide maintained. It provides a fully functional version of a single, rather than as MySQL provides a number of different communities, Business and Enterprise editions. PostgreSQL's BSD-based free / MIT license, organizations can use, copy, modify and redistribute the code, you only need to provide a copyright notice.

PostgreSQL's reliability is the highest priority. It's good quality and rock-solid engineering known for high-transaction support, mission-critical applications. PostgreSQL documentation is very sophisticated, offers a number of free online manuals, reference manuals for archiving older versions. PostgreSQL community support is great, as well as from independent vendors of commercial support.
PostgreSQL data consistency and integrity is a high priority properties. PostgreSQL is fully supported ACID properties, which provides strong security guarantee for database access, full use of enterprise security tools, such as Kerberos and OpenSSL and so on. You can define your own checks to ensure data quality according to your business rules. Among the many management features in, point-in-time recovery ( PITR) is a great feature, it is a flexible high availability features, such as providing for the failure to create a hot backup and recovery snapshot and the ability to recover. But this is not all PostgreSQL, the project also provides several ways to manage PostgreSQL in order to achieve high availability, load balancing and replication, so you can use the functions suited to their specific needs of the.

4. Platform
MySQL and PostgreSQL have appeared in some high-traffic Web site:

MySQL: Slashdot, Twitter, Facebook and Wikipedia
PostgreSQL: Yahoo uses a modified PostgreSQL database to handle hundreds of millions of daily events, as well as Reddit and Disqus

MySQL and PostgreSQL can run on multiple operating systems, such as Linux, Unix, Mac OS X and Windows. They are open source, free, so the only cost of the test when they are your time and hardware. They are very flexible and scalable, available on small systems and large-scale distributed systems. MySQL than PostgreSQL further on a field that extends its tentacles into the embedded field, which is achieved by libmysqld. PostgreSQL does not support embedded applications, still stick to the traditional client / server architecture.

MySQL is generally considered to be the site for a fast back-end database and application can be quickly read and a large number of query operations, but not very satisfactory in the complex nature and terms of data integrity checks.
PostgreSQL is serious for transactional enterprise applications, fully functional database that supports ACID properties and a lot of strong data integrity checking. Both of them have very high speed on certain tasks, MySQL storage engine different behaviors are very different. MyISAM engine is the fastest, because it rarely perform data integrity checks, read more suited to the back-end operating site, but to read sensitive data / write database, it is a disaster, because MyISAM table It may eventually be damaged. MySQL provides the tools to repair MySQL tables, but for sensitive data, it supports InnoDB is the ACID properties of a better choice.

In contrast, PostgreSQL is the only fully integrated single database storage engine. You can improve performance by adjusting parameters postgresql.conf file, you can also adjust the queries and transactions. PostgreSQL documentation for performance tuning provides a very detailed introduction.

MySQL and PostgreSQL are highly configurable, and can accordingly optimized for different tasks. They are supported to add additional functionality through extensions.

A common misconception is that MySQL than PostgreSQL easier to learn. Relational database systems are very complex, the learning curve these two databases is actually the same.

5. Standard compatibility
PostgreSQL SQL aimed at achieving compatibility (the current standard is ANSI-SQL: 2008). MySQL is compatible with most SQL, but also has its own extensions to support NoSQL features, which are described in the reference manual. Each approach has advantages and disadvantages. Compatible with standard let database administrators, database developers and application developers more comfortable, because it means they only have to learn a set of standards, a set of features and command. This will save time, improve efficiency, it will not be locked on a specific vendor.

Supports the use of non-standard custom function has been deemed to quickly adopt new features without waiting for the standard process to complete. ANSI / ISO standard is constantly evolving, so the standard compatibility is also a moving target: the well-known relational database Microsoft SQL Server, Oracle and IBM DB2 only partially compatible with the standard.

6. Conclusions
Although there are different histories, engine and tools, but there is no clear reference able to show that these two databases which can be applied in all cases. Many organizations prefer to use PostgreSQL, because of its reliability good, very good in terms of data protection, and is a community project, it does not fall into the cage manufacturers. MySQL is more flexible and provides more options for different tasks crop. In many cases, for an organization, the more important reasons for a certain proficiency in use of the software than the features.

Published 54 original articles · won praise 28 · views 4191

Guess you like

Origin blog.csdn.net/qq_37174887/article/details/104071940