comparison report on mysql and postgresql
DESCRIPTION
Comparison Report on MySQL and PostgreSQL OSCC MAMPU MalaysiaTRANSCRIPT
MALAYSIAN PUBLIC SECTOR
OPEN SOURCE SOFTWARE (OSS)
PROGRAM
COMPARISON REPORT ON
MySQL and PostgreSQL
NOVEMBER 2009
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Copyright
The government of Malaysia retains the copyright of this document.
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Table of Contents
SECTION 1 : INTRODUCTION.................................................................................................1EXECUTIVE SUMMARY........................................................................................................2INTRODUCTION....................................................................................................................2DISCLAIMER..........................................................................................................................3
SECTION 2 : COMPARISON / EVALUATION TABLE................................................................4SOFTWARE USE FOR COMPARISON.................................................................................5
SOFTWARE 1 : MySQL.....................................................................................................6SOFTWARE 2 : PostgreSQL..............................................................................................6
COMPARISON OF FINDING..................................................................................................7SECTION 3 : DRUPAL BENCHMARKING...............................................................................17
BENCHMARKING DRUPAL ON POSTGRESQL VS. MYSQL........................................18BENCHMARK SETUP......................................................................................................18DRUPAL SETUP...............................................................................................................18POSTGRESQL CONFIGURATION..................................................................................18CREATING A POSTGRESQL USER AND DATABASE...................................................19MYSQL CONFIGURATION..............................................................................................19RUNNING THE BENCHMARKS......................................................................................20BENCHMARKING METHODOLOGY...............................................................................20
BASH SCRIPT FOR MYSQL.......................................................................................20BASH SCRIPT FOR POSTGRESQL...........................................................................21
MYSQL RESULTS............................................................................................................21POSTGRESQL RESULTS................................................................................................21
SECTION 4 : SUMMARY AND CONCLUSIONS......................................................................22MYSQL AND POSTGRESQL : SUMMARY.....................................................................23MYSQL AND POSTGRESQL : CONCLUSIONS.............................................................23
APPENDIX A.........................................................................................................................24MYSQL AND POSTGRESQL : SPEED............................................................................24MYSQL AND POSTGRESQL : CONCURRENCY OF 1..................................................25MYSQL AND POSTGRESQL : CONCURRENCY OF 5..................................................25
APPENDIX B........................................................................................................................26Result from Apache Benchmark for MySQL with concurrency of 1.................................26Test 1................................................................................................................................26
Test 2............................................................................................................................28Test 3............................................................................................................................30Test 4............................................................................................................................32Test 5............................................................................................................................34
Result from Apache Benchmark for MySQL with concurrency of 5.................................36Test 1............................................................................................................................36Test 2............................................................................................................................38Test 3............................................................................................................................40Test 4............................................................................................................................42Test 5............................................................................................................................44
Result from Apache Benchmark for PostgreSQL with concurrency of 1..........................46
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 1............................................................................................................................46Test 2............................................................................................................................48Test 3............................................................................................................................50Test 4............................................................................................................................52Test 5............................................................................................................................54
Result from Apache Benchmark for PostgreSQL with concurrency of 5..........................56Test 1............................................................................................................................56Test 2............................................................................................................................58Test 3............................................................................................................................60Test 4............................................................................................................................62Test 5 ...........................................................................................................................64
SECTION 5 : REFERENCES....................................................................................................66REFERENCES.....................................................................................................................67
Index of Tables
Table 1: Features Comparison between MySQL and PostgreSQL..........................................15Table 2: Summary results of concise form................................................................................24Table 3: Data collection using Mozilla Firefox 3.5.x with YSLOW extension...........................25Table 4: Refer to Appendix B....................................................................................................26Table 5: Refer to Appendix B....................................................................................................26
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SECTION 1 : INTRODUCTION
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
EXECUTIVE SUMMARY
A database can be defined as a set of data that has a regular structure and that is organized
in such a way that a computer can easily find the information stored. Database has become
one of the many essential tools to have in running an organization. Data is a collection of
distinct pieces of information, particularly information that has been formatted (i.e., organized)
in some specific way for use in analysis or making decisions. Those data can be organized
and managed using databases.
Nowadays, the emerging of database software has grown rapidly due to the importance of the
database for organizations. We can choose databases ranging from proprietary to open
source database such as MSSQL, MySQL and PostgreSQL. All databases essentially serve
the same purpose of a storing base for collection of associated files, but performance and
reliability might be differ from one another.
In this report, we will present findings on feature comparisons between MySQL and
PostgreSQL, both are Open Source databases. The findings can be used as references for
agencies that want to adopt or implement Open Source databases for internal or external
systems, email server or portal.
INTRODUCTION
Databases are used every day, sometimes without us realizing. They are everywhere. The
most basic example is a telephone book or a library card index. They can store all sorts of
information, from phone numbers to map grids and references, score cards from sports
games, report cards, etc. They allow quick searching and are great for keeping historical data,
for example weather history. Many websites run using a combination of a database and a
CMS (content management system).
Page 2
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
DISCLAIMER
This reports contains elements which are very technical in nature. People reading this
document are expected to have basic database knowledge. All the data manipulation and
information in this document are base on Research and Development done at OSCC
MAMPU.
Page 3
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SECTION 2 : COMPARISON / EVALUATION
TABLE
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SOFTWARE USE FOR COMPARISON
The choice between MySQL and PostgreSQL is a decision many frequently make when
choosing Open Source relational databases management systems. Among many technical
users, MySQL has long been assumed to be the faster but less full-featured of the two
database systems, while PostgreSQL is assumed to be a more densely featured database
system and is often described as an open-source version of Oracle. MySQL is popular stack
among various software projects because of its percieved ease of use, while PostgreSQL has
has a large following among developers comng from an Oracle or traditional SQL Server
backgrounds.
These assumptions, however, are mostly outdated and incorrect. MySQL has come a long
way since in adding advanced functionality while PostgreSQL has dramatically improved its
speed within the last few major releases. Many, however, are unaware of the improvement
and still hold on to stereotypes based on MySQL 4.1 and PostgreSQL 7.4. The current
versions are MySQL 5.1 and PostgreSQL 8.4.
Also, the speed comparisons are mainly between MyISAM and PostgreSQL engines. If the
comparison is between the latest versions of InnoDB and PostgreSQL, PostgreSQL is often
considered faster but no comparison is performed for this report.
Page 5
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SOFTWARE 1 : MySQL
MySQL is available in both binary and source code form; it may be modified and
redistributed. Its usage terms are regulated by a double GNU General
Public Licence version 2(GPLv2) /proprietary license.
Binaries and source code are available free of charge. As per the GPLv2
licensing terms, any redistribution of the binaries must be accompanied by
the source code from which they are derived, whether original or modified. An exception to
the GPLv2 licensing requirements is made for a few Free Libre Open Source Software
(FLOSS) programs that use MySQL.
Those not wanting to abide to those terms may buy a proprietary license from MySQL
Inc. Support contracts are also available from the same supplier.
MySQL runs on many Unix-like operating systems, is included in most Linux distributions, and
runs natively on Microsoft Windows.
Current stable version: 5.1.x
SOFTWARE 2 : PostgreSQL
PostgreSQL is available in both binary and source code form; it may be
modified and redistributed. Its usage terms are regulated by a Berkeley
Software Distribution (BSD) -like license, that includes no source code
redistribution requirements.
Binaries and source code are available free of charge. Support contracts are available from
many independent firms.
PostgreSQL runs on many Unix-like operating systems, is included in most Linux
distributions, and runs natively on Microsoft Windows since version 8.0. Current stable
version: 8.4.x
Page 6
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
COMPARISON OF FINDING
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
Raw Speed fast when concurrent access
levels are low, and when there
are many more reads than
writes. On the other hand, it
exhibits low scalability with
increasing loads and write/read
ratios (1)
relatively slow at low concurrency
levels, but scales well with
increasing load levels, while
providing enough isolation between
concurrent accesses to avoid
slowdowns at high write/read ratios (1)
Data Compression supports live compression
since version 5.0 with the
ARCHIVE storage engine.
Archive is a write-once, read-
many storage engine, designed
for historical data. It
compresses data up to 90%. It
does not support indexes. In
version 5.1 Archive engine can
be used with partitioning
Support both live compression and
decompression with a fast
compression scheme to fit more
data in an allotted disk space. The
advantage of compressed data,
besides saving disk space, is that
reading data takes less IO, resulting
in faster data reads
Support Multi-
Processor
Yes Yes
Concurrency focuses on scale-out
technologies and the use of off-
the-shelf commodity hardware (1)
scales much better, both in terms of
using up-scale hardware, and
dealing with concurrency (1)
Asynchronous I/O lacks Async support, though
some drivers have been
created to attempt to overcome
this deficiency using Perl and
supports a full fledged
asynchronous API for use by client
applications. It is reported to
increase performance by up to 40%
Page 8
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
Ruby in some cases.
ACID (Atomicity,
Consistency, Isolation
and Durability)
Compliance
Yes(2) Yes (fully compliant)
Ease of use Both have an impressive array of features that increase data
integrity, functionality and performance. The features included in a
database may help improve performance, ease of use, functionality
and stability
Constraints - supports Not-Null, Unique,
Primary Key and Foreign Key
constraints
- doesn't supports the Check
constraint
- supports Not-Null, Unique, Primary
Key and Foreign Key constraints
- supports the Check constraint for a
long time
Default Values NOW() is the only function that
can be used as a default value,
in a MySQL table
allows for any function marked as
IMMUTABLE or STABLE to be used
as the default value for a column
Support Stored
Procedures
Yes Yes
Triggers Yes Yes
Replication and High
Availability
Yes Yes
Data Types - does not have network IP
address data types that
PostgreSQL has but does
provide INET_ATON() and
INET_NTOA() functions to
convert IPv4 addresses to and
- does not have an unsigned integer
data type, but it has a much richer
data type support in several
aspects: standards compliance, the
logically fundamental data type
BOOLEAN, user-defined data types
Page 9
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
from easily stored integers mechanism, built-in and contributed
data types
- allows columns of a table to be
defined as variable-length
multidimensional arrays. Arrays of
any built-in or user-defined base
type, enum type, or composite type
can be created. Arrays of domains
are not yet supported
Support Subqueries Yes
(but in some forms can be a
huge performance liability. This
will be corrected in version 6.0)
Yes
Partitioning • RANGE
• LIST
• HASH
• KEY
• Composite partitioning using
a combination of RANGE or
LIST with HASH or KEY
subpartitions
• RANGE
• LIST
• HASH partitioning is supported
via immutable functions.
Composite partitioning is also
supported
Data Storage Engines • MyISAM (with full text search
function)
• InnoDB (with transactions,
referential, integrity functions
active)
• PostgreSQL can have both full
text search and transactions,
referential by default
Numbers of Data 9 1
Page 10
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
Storage Engines
Supported
(MySQL functionality is
extended via differrent usage of
Data Storage Engines)
(PostgreSQL has many of MySQL's
Data Storage Engines'
functionalities)
Licensing GPLv2 / Proprietary BSD
Maintainer Sun Microsystems PostgreSQL Global Development
Group
Community Support Yes Yes
Database
Administration Tool
(Web Based)
phpMyAdmin phpPgAdmin
Supported Operating Systems :
Windows Yes Yes
Mac OS X Yes Yes
Linux Yes Yes
BSD Yes Yes
UNIX Yes Yes
AmigaOS Yes Yes
Symbian Yes No
Advanced Indexing
Index Type
Hash indexes Only InnoDB and MEMORY
supports Hash indexes
PostgreSQL supports Hash indexes,
though they are never faster than b-
tree indexes
Multiple Indexes MySQL supports multiple
indexes per table and query
since 5.0.
PostgreSQL supports multiple
indexes per query.
Full-Text Indexes MySQL comes with full-text PostgreSQL 8.2 has full text search
Page 11
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
search, but can only be run on
the (not transaction safe)
MyISAM storage engine.
A 3rd party add-on to MySQL,
Sphinx Fulltext Search Engine
allows it to support full-text
searches of InnoDB tables.
in the tsearch2 module.
PostgreSQL 8.3 integrates tsearch2
into the core: "TSearch2, our
cutting-edge full text search tool,
has been fully integrated into the
core code, and also has a cleaner
API."
Partial Indexes MySQL does not support partial
indexes.
PostgreSQL supports partial
indexes:
A partial index is an index built over
a subset of a table; the subset is
defined by a conditional expression
(called the predicate of the partial
index). The index contains entries
for only those table rows that satisfy
the predicate. Partial indexes are a
specialized feature, but there are
several situations in which they are
useful.
One major reason for using a partial
index is to avoid indexing common
values. Since a query searching for
a common value (one that accounts
for more than a few percent of all
the table rows) will not use the index
anyway, there is no point in keeping
those rows in the index at all. This
Page 12
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
reduces the size of the index, which
will speed up queries that do use
the index. It will also speed up many
table update operations because
the index does not need to be
updated in all cases.
Prefix Indexes MySQL supports prefix
indexes. Prefix indexes cover
the first N characters of a string
column, making the index much
smaller than one that covers
the entire width of the column,
yet still provide good
performance characteristics.
With PostgreSQL, prefix indexes
are a particular case of Expression
Indexes
Multi-column Indexes MySQL is limited to 16 columns
per index.
PostgreSQL is limited to 32 columns
per index.
Bitmap Indexes MySQL has no bitmap indexes
but achieves similar
functionality using its
"index_merge" feature. Bitmap
indexes will be introduced with
the Falcon engine.
PostgreSQL supports the ability to
combine multiple indexes at query
time using bitmap indexes.
Expression Indexes Expression Indexes can be
emulated in MySQL by adding
a precomputed column and
using a trigger to maintain it.
PostgreSQL allows you to create
indexes based on expressions
(which may include calls to
immutable functions). This is very
Page 13
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
handy when you have a table with
relatively stable data (not a lot of
inserts / updates) and will often be
running a query which involves an
expensive calculation.
Non-blocking
CREATE INDEX
Dependent on the storage
engine. Some engines (such as
MySQL Cluster and InnoDB
Plugin) support online add/drop
index (no locks taken). If the
engine doesn't support online
add/drop index, a write
exclusive lock is required and
the table copied.
PostgreSQL supports the ability to
create indexes without locking the
table for writes.
Maximum Table Size - 2 GB on Windows
- 2 TB on MacOSX with HFS+
- 4 TB on Linux 2.4+ with
ext3FS
- 16 TB on Solaris with ZFS
32 TB
Maximum Row Size - 65 KB (VarChar / VarBinary)
- 4 GB (LongTEXT /
LongBLOB)
1.6 TB
Maximum Field Size 4 GB 1 GB
Maximum Rows per
Table
Unlimited (with InnoDB) Unlimited
Maximum Columns
per Table
1000 250 – 1600 depending on column
types
Page 14
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
FEATURES MySQL PostgreSQL
Maximum Indexes per
Table
Unlimited Unlimited
Other Objects:
Data Domain No Yes
Cursor Yes Yes
Trigger Yes Yes
Function Yes Yes
Procedure Yes Yes
External routine Yes Yes
Access Control
Native network
encryption
Yes (with SSL 4.0) Yes
Brute-force protection No No
Enterprise directory
compatibility
No Yes (LDAP, Kerberos)
Password complexity
rules
No No
Patch access Partial (no security page) Yes
Run unprivileged Yes Yes
Security Certification No Yes (EAL1 3)
Table 1: Features Comparison between MySQL and PostgreSQL
Page 15
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Note (1): Base on Drupal Benchmarking Summary at Section 3
Note (2): For transactions and referential integrity, the InnoDB table type must be used;
Windows installer sets this as default if support for transactions is selected. On other
operating systems the default table type is MyISAM. However, even the InnoDB table type
permits storage of values that exceed the data range; some view this as violating the Integrity
constraint of ACID.
Note (3): Network traffic could be transmitted in a secure way (not clear-text, on general SSL
encryption). In order to have precise option as default, the included options or extra modules
must be purchased.
Page 16
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SECTION 3 : DRUPAL BENCHMARKING
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
BENCHMARKING DRUPAL ON POSTGRESQL VS. MYSQL
This article is about performance of Drupal on both MySQL and PostgreSQL.
So, I decided to do a controlled benchmark of Drupal 6 on both databases to see which
database is faster.
BENCHMARK SETUP
For the hardware, I used my notebook, which is an Intel(R) Core(TM)2 Duo CPU T7100 @
1.80GHz, with 3 GB of RAM.
This server runs Ubuntu Desktop 9.10 Karmic Koala i686.
MySQL is 5.1.37-1ubuntu5, and PostgreSQL is 8.4.1-1, which are what comes with this distro
version. PHP is 5.2.10-2ubuntu6.3, with APC (Alternative PHP Cache) 3.0.19-2 installed and
configured.
DRUPAL SETUP
Drupal is the latest 6.14 version from http://ftp.drupal.org/files/projects/drupal-6.14.tar.gz.
The setup was a multisite install, so both sites are running from the same code base. One
was configured for MySQL and one for PostgreSQL.
POSTGRESQL CONFIGURATION
Setting up a PostgreSQL database took some digging, but once the steps are figured out,
they are fairly simple.
No other changes from the default settings provided by Ubuntu are made.
Page 18
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
CREATING A POSTGRESQL USER AND DATABASE
The steps to create a database in PostgreSQL are documented in the INSTALL.pgsql.txt that
comes with Drupal.
However, I used a slightly different approach, with the same end result.
For creating a user and database, assuming we want a user called drupal and a password
of drupal123, you do the following in a shell:
$ sudo bash# su - postgres$ createuser -DRS username$ createdb -O username drupal$ psqlALTER USER USERNAME WITH UNENCRYPTED PASSWORD 'drupal123';
Once the database is created, install drupal6 by executing this command in
terminal:
$ sudo apt-get install drupal6
After finish the installation, visit URL,
http://localhost/drupal6/install.php then proceed with the web base installation and key in the credential about
MySQL and PostgreSQL such as Username, Password, Host, Port and etc so Drupal
will create the tables for you in the database.
MYSQL CONFIGURATION
The default configuration supplied with Ubuntu was used. This has the query cache turned on
by default. All the tables are MyISAM.
Page 19
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
RUNNING THE BENCHMARKS
The benchmark consisted of running two benchmarks using ab on each virtual host.
One benchmark was for a concurrency of 1:
ab -c1 -n1000 http://localhost/drupal6/ (MySQL)
ab -c1 -n1000 http://localhost/drupalpg/ (PostgreSQL)
The other was with a concurrency of 5:
ab -c5 -n1000 http://localhost/drupal6/ (MySQL)
ab -c5 -n1000 http://localhost/drupalpg/ (PostgreSQL)
BENCHMARKING METHODOLOGY
For setting up data for this test, I insert data into database, bash script was used to create
2000 comments and manually add 1 page. Im not using the Drupal's Devel Module to
generate content and pages because its need to amend the default configuration for php.ini .
BASH SCRIPT FOR MYSQL
#!/bin/bash
for i in `seq 1 2000`;
do
echo $i
mysql -usql -e"use drupal6;INSERT INTO comments (pid, nid, uid, subject, comment, hostname, timestamp, status, format, name, mail, homepage) VALUES (0, 1, 1, 'Testing Comment', 'Benchmark Testing Comment 123456', '::1', 1260193872, 0, 1, 'fenris', '', '')"
done
Page 20
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
BASH SCRIPT FOR POSTGRESQL
#!/bin/bash
for i in `seq 1 2000`;
do
echo $i
sudo -u postgres psql -U postgres -d drupal -c "INSERT INTO comments (pid, nid, uid, subject, comment, hostname, timestamp, status, format, thread, name, mail, homepage) VALUES (0, 1, 1, 'Testing Comment', 'Benchmark Testing Comment 123456', '::1',1260193872, 0, 1, '01/', 'fenris', 'mohdfenrisgmail.com', '')"
done
MYSQL RESULTS
MySQL with Drupal's Devel module
When hitting the front page of the site, the MySQL site shows this:
Page execution time was 88.57 ms. Executed 36 queries in 10.73 milliseconds.
POSTGRESQL RESULTS
PostgreSQL with Drupal's Devel module
When hitting the front page of the site, the PostgreSQL site shows this:
Page execution time was 221.52 ms. Executed 38 queries in 102.16 milliseconds.
Page 21
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SECTION 4 : SUMMARY AND CONCLUSIONS
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
MYSQL AND POSTGRESQL : SUMMARY
The following table shows a summary of the results in a concise form.
Table 2: Summary results of concise form
MYSQL AND POSTGRESQL : CONCLUSIONS
MySQL was built for speed, to the detriment of everything else. SQL standard features like
transactions, referential integrity and others have been grafted over only after considerable
arm twisting.
However, it is only fast at low concurrency levels, and reports of instability, low robustness
and scalability keep coming out.
PostgreSQL was built strictly following the ACID model, with an emphasis on data integrity
and SQL standard compliance, speed notwithstanding. It then underwent optimizations and
speedups, while at the same time adding new features to its already large set.
Today it is robust, standards compliant and well featured. While still being relatively slow at
low concurrency levels, it scales well with increasing load levels.
The definite conclusion from these benchmarks is that out of the box, MySQL is configured to
run faster than PostgreSQL.
FUTURE CONSIDERATIONS
PostgreSQL can probably be made better by further tuning.
Page 23
Database MySQL PostgreSQLTotal time taken for front page (milliseconds) 88.57 221.52Time for front page queries (milliseconds) 10.73 102.16
2260.2 2251.5
25.09 5.54
44.97 11.02
Total time taken for page with 2000 comments (milliseconds)Concurrency of 1 using Apache Benchmark (requests per second) Concurrency of 5 using Apache Benchmark (requests per second)
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
APPENDIX A
MYSQL AND POSTGRESQL : SPEED
Table 3: Data collection using Mozilla Firefox 3.5.x with YSLOW extension
Page 24
Test Database MySQL PostgreSQL
1 2199 2172
2 2418 2412
3 2223 2190
4 2196 2224
5 2381 2379
6 2393 2186
7 2190 2177
8 2199 2200
9 2209 2218
10 2194 2357
Average 2260.2 2251.5
Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)Total time taken for page with 2000 comments (milliseconds)
Total time taken for page with 2000 comments (milliseconds)
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
MYSQL AND POSTGRESQL : CONCURRENCY OF 1
Table 4: Refer to Appendix B
MYSQL AND POSTGRESQL : CONCURRENCY OF 5
Table 5: Refer to Appendix B
Page 25
Test Database
1 25.28 5.49
2 25.55 5.46
3 24.35 5.54
4 25.55 5.62
5 24.73 5.61
Average 25.09 5.54
MySQL PostgreSQLConcurrency of 1 using Apache Benchmark (requests per second) Concurrency of 1 using Apache Benchmark (requests per second) Concurrency of 1 using Apache Benchmark (requests per second) Concurrency of 1 using Apache Benchmark (requests per second) Concurrency of 1 using Apache Benchmark (requests per second)
Concurrency of 1 using Apache Benchmark (requests per second)
Test Database
1 46.57 10.88
2 43.85 11.09
3 44.21 11.01
4 43.86 11.16
5 46.38 10.98
Average 44.97 11.02
MySQL PostgreSQLConcurrency of 5 using Apache Benchmark (requests per second) Concurrency of 5 using Apache Benchmark (requests per second) Concurrency of 5 using Apache Benchmark (requests per second) Concurrency of 5 using Apache Benchmark (requests per second) Concurrency of 5 using Apache Benchmark (requests per second)
Concurrency of 5 using Apache Benchmark (requests per second)
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
APPENDIX B
Result from Apache Benchmark for MySQL with concurrency of 1
Test 1
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 1 Time taken for tests: 39.555 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 25.28 [#/sec] (mean) Time per request: 39.555 [ms] (mean)
Page 26
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Time per request: 39.555 [ms] (mean, across all concurrent requests) Transfer rate: 133.86 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 35 39 5.7 38 90 Waiting: 35 39 5.7 37 90 Total: 35 39 5.7 38 91
Percentage of the requests served within a certain time (ms) 50% 38 66% 39 75% 40 80% 41 90% 45 95% 50 98% 57 99% 70 100% 91 (longest request)
Page 27
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 2
fenris@thinkbuntu:~$ ab -c1 -n1000 http://localhost/drupal6/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 1 Time taken for tests: 39.141 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 25.55 [#/sec] (mean) Time per request: 39.141 [ms] (mean) Time per request: 39.141 [ms] (mean, across all concurrent requests) Transfer rate: 135.28 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max
Page 28
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connect: 0 0 0.0 0 0 Processing: 35 39 5.9 37 95 Waiting: 35 39 5.9 37 95 Total: 35 39 5.9 37 95
Percentage of the requests served within a certain time (ms) 50% 37 66% 38 75% 39 80% 41 90% 44 95% 49 98% 59 99% 68 100% 95 (longest request)
Page 29
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 3
fenris@thinkbuntu:~$ ab -c1 -n1000 http://localhost/drupal6/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 1 Time taken for tests: 41.062 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 24.35 [#/sec] (mean) Time per request: 41.062 [ms] (mean) Time per request: 41.062 [ms] (mean, across all concurrent requests) Transfer rate: 128.95 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max
Page 30
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connect: 0 0 0.0 0 0 Processing: 35 41 7.1 39 106 Waiting: 35 41 6.9 38 106 Total: 35 41 7.1 39 106
Percentage of the requests served within a certain time (ms) 50% 39 66% 40 75% 42 80% 43 90% 48 95% 57 98% 66 99% 71 100% 106 (longest request)
Page 31
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 4
fenris@thinkbuntu:~$ ab -c1 -n1000 http://localhost/drupal6/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 1 Time taken for tests: 39.140 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 25.55 [#/sec] (mean) Time per request: 39.140 [ms] (mean) Time per request: 39.140 [ms] (mean, across all concurrent requests) Transfer rate: 135.28 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max
Page 32
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connect: 0 0 0.0 0 1 Processing: 35 39 4.9 38 90 Waiting: 23 39 5.0 37 89 Total: 35 39 4.9 38 90
Percentage of the requests served within a certain time (ms) 50% 38 66% 39 75% 40 80% 40 90% 43 95% 47 98% 56 99% 63 100% 90 (longest request)
Page 33
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 5
fenris@thinkbuntu:~$ ab -c1 -n1000 http://localhost/drupal6/ This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 1 Time taken for tests: 40.438 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 24.73 [#/sec] (mean) Time per request: 40.438 [ms] (mean) Time per request: 40.438 [ms] (mean, across all concurrent requests) Transfer rate: 130.94 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max
Page 34
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connect: 0 0 0.0 0 0 Processing: 36 40 6.1 38 103 Waiting: 35 40 6.0 38 103 Total: 36 40 6.1 38 103
Percentage of the requests served within a certain time (ms) 50% 38 66% 40 75% 41 80% 42 90% 46 95% 53 98% 61 99% 65 100% 103 (longest request)
Page 35
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Result from Apache Benchmark for MySQL with concurrency of 5
Test 1
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 5 Time taken for tests: 21.472 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 46.57 [#/sec] (mean) Time per request: 107.361 [ms] (mean) Time per request: 21.472 [ms] (mean, across all concurrent requests) Transfer rate: 246.59 [Kbytes/sec] received
Page 36
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 37 107 31.1 106 269 Waiting: 37 105 30.5 104 269 Total: 37 107 31.1 106 269
Percentage of the requests served within a certain time (ms) 50% 106 66% 119 75% 128 80% 132 90% 148 95% 157 98% 180 99% 188 100% 269 (longest request)
Page 37
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 2
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 5 Time taken for tests: 22.806 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 43.85 [#/sec] (mean) Time per request: 114.029 [ms] (mean) Time per request: 22.806 [ms] (mean, across all concurrent requests) Transfer rate: 232.18 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 40 114 34.4 112 257
Page 38
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 39 111 33.2 109 248 Total: 40 114 34.4 112 257
Percentage of the requests served within a certain time (ms) 50% 112 66% 126 75% 134 80% 141 90% 159 95% 174 98% 193 99% 207 100% 257 (longest request)
Page 39
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 3
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 5 Time taken for tests: 22.620 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 44.21 [#/sec] (mean) Time per request: 113.100 [ms] (mean) Time per request: 22.620 [ms] (mean, across all concurrent requests) Transfer rate: 234.08 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.4 0 12 Processing: 38 113 33.6 112 243
Page 40
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 38 111 32.6 109 237 Total: 38 113 33.6 112 243
Percentage of the requests served within a certain time (ms) 50% 112 66% 125 75% 134 80% 140 90% 156 95% 172 98% 185 99% 201 100% 243 (longest request)
Page 41
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 4
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 5 Time taken for tests: 22.801 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 43.86 [#/sec] (mean) Time per request: 114.003 [ms] (mean) Time per request: 22.801 [ms] (mean, across all concurrent requests) Transfer rate: 232.23 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 2 Processing: 37 114 31.2 113 278
Page 42
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 37 111 30.8 110 278 Total: 37 114 31.2 114 278
Percentage of the requests served within a certain time (ms) 50% 114 66% 127 75% 133 80% 139 90% 153 95% 165 98% 180 99% 196 100% 278 (longest request)
Page 43
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 5
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupal6/ Document Length: 4886 bytes
Concurrency Level: 5 Time taken for tests: 21.559 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5422000 bytes HTML transferred: 4886000 bytes Requests per second: 46.38 [#/sec] (mean) Time per request: 107.794 [ms] (mean) Time per request: 21.559 [ms] (mean, across all concurrent requests) Transfer rate: 245.60 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 38 108 29.9 107 234
Page 44
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 38 105 29.4 104 205 Total: 38 108 30.0 107 234
Percentage of the requests served within a certain time (ms) 50% 107 66% 120 75% 128 80% 133 90% 145 95% 156 98% 170 99% 192 100% 234 (longest request)
Page 45
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Result from Apache Benchmark for PostgreSQL with concurrency of 1
Test 1
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 1 Time taken for tests: 182.178 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 5.49 [#/sec] (mean) Time per request: 182.178 [ms] (mean) Time per request: 182.178 [ms] (mean, across all concurrent requests) Transfer rate: 29.04 [Kbytes/sec] received
Page 46
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 2 Processing: 158 182 20.2 177 332 Waiting: 158 182 20.2 176 332 Total: 158 182 20.2 177 332
Percentage of the requests served within a certain time (ms) 50% 177 66% 184 75% 190 80% 193 90% 209 95% 221 98% 240 99% 257 100% 332 (longest request)
Page 47
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 2
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 1 Time taken for tests: 183.131 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 5.46 [#/sec] (mean) Time per request: 183.131 [ms] (mean) Time per request: 183.131 [ms] (mean, across all concurrent requests) Transfer rate: 28.89 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 157 183 22.2 177 408
Page 48
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 157 183 22.1 176 404 Total: 157 183 22.2 177 409
Percentage of the requests served within a certain time (ms) 50% 177 66% 184 75% 190 80% 196 90% 209 95% 223 98% 245 99% 267 100% 409 (longest request)
Page 49
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 3
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 1 Time taken for tests: 180.588 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 5.54 [#/sec] (mean) Time per request: 180.588 [ms] (mean) Time per request: 180.588 [ms] (mean, across all concurrent requests) Transfer rate: 29.29 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 158 180 17.9 175 286
Page 50
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 157 180 17.7 175 286 Total: 158 181 17.9 175 286
Percentage of the requests served within a certain time (ms) 50% 175 66% 183 75% 188 80% 193 90% 205 95% 214 98% 229 99% 252 100% 286 (longest request)
Page 51
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 4
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 1 Time taken for tests: 178.048 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 5.62 [#/sec] (mean) Time per request: 178.048 [ms] (mean) Time per request: 178.048 [ms] (mean, across all concurrent requests) Transfer rate: 29.71 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 158 178 14.4 174 279
Page 52
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 158 178 14.3 174 278 Total: 158 178 14.4 174 279
Percentage of the requests served within a certain time (ms) 50% 174 66% 180 75% 184 80% 187 90% 201 95% 207 98% 215 99% 220 100% 279 (longest request)
Page 53
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 5
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 1 Time taken for tests: 178.096 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 5.61 [#/sec] (mean) Time per request: 178.096 [ms] (mean) Time per request: 178.096 [ms] (mean, across all concurrent requests) Transfer rate: 29.70 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 158 178 15.0 174 340
Page 54
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 158 178 15.0 174 340 Total: 158 178 15.0 174 340
Percentage of the requests served within a certain time (ms) 50% 174 66% 180 75% 185 80% 187 90% 198 95% 208 98% 216 99% 225 100% 340 (longest request)
Page 55
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Result from Apache Benchmark for PostgreSQL with concurrency of 5
Test 1
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 5 Time taken for tests: 91.875 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 10.88 [#/sec] (mean) Time per request: 459.375 [ms] (mean) Time per request: 91.875 [ms] (mean, across all concurrent requests) Transfer rate: 57.58 [Kbytes/sec] received
Page 56
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.2 0 5 Processing: 174 459 120.6 460 914 Waiting: 174 454 120.1 456 914 Total: 174 459 120.6 460 914
Percentage of the requests served within a certain time (ms) 50% 460 66% 507 75% 540 80% 560 90% 610 95% 665 98% 712 99% 756 100% 914 (longest request)
Page 57
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 2
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 5 Time taken for tests: 90.181 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 11.09 [#/sec] (mean) Time per request: 450.907 [ms] (mean) Time per request: 90.181 [ms] (mean, across all concurrent requests) Transfer rate: 58.66 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 192 450 109.0 452 793
Page 58
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 192 446 108.3 445 793 Total: 192 450 109.0 452 793
Percentage of the requests served within a certain time (ms) 50% 452 66% 495 75% 526 80% 543 90% 590 95% 629 98% 680 99% 713 100% 793 (longest request)
Page 59
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 3
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 5 Time taken for tests: 90.854 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 11.01 [#/sec] (mean) Time per request: 454.268 [ms] (mean) Time per request: 90.854 [ms] (mean, across all concurrent requests) Transfer rate: 58.23 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 176 454 104.7 453 849
Page 60
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 176 450 103.7 450 809 Total: 176 454 104.7 453 849
Percentage of the requests served within a certain time (ms) 50% 453 66% 498 75% 526 80% 542 90% 582 95% 618 98% 673 99% 723 100% 849 (longest request)
Page 61
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 4
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 5 Time taken for tests: 89.570 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 11.16 [#/sec] (mean) Time per request: 447.850 [ms] (mean) Time per request: 89.570 [ms] (mean, across all concurrent requests) Transfer rate: 59.06 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 177 447 113.2 448 874
Page 62
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 177 442 112.9 444 874 Total: 177 447 113.2 448 874
Percentage of the requests served within a certain time (ms) 50% 448 66% 495 75% 523 80% 540 90% 593 95% 635 98% 676 99% 716 100% 874 (longest request)
Page 63
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Test 5
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient) Completed 100 requests Completed 200 requests Completed 300 requests Completed 400 requests Completed 500 requests Completed 600 requests Completed 700 requests Completed 800 requests Completed 900 requests Completed 1000 requests Finished 1000 requests
Server Software: Apache/2.2.12 Server Hostname: localhost Server Port: 80
Document Path: /drupalpg/ Document Length: 4881 bytes
Concurrency Level: 5 Time taken for tests: 91.064 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 5417000 bytes HTML transferred: 4881000 bytes Requests per second: 10.98 [#/sec] (mean) Time per request: 455.322 [ms] (mean) Time per request: 91.064 [ms] (mean, across all concurrent requests) Transfer rate: 58.09 [Kbytes/sec] received
Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.0 0 0 Processing: 183 454 115.8 458 891
Page 64
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
Waiting: 183 450 115.1 452 891 Total: 183 455 115.8 458 891
Percentage of the requests served within a certain time (ms) 50% 458 66% 507 75% 536 80% 553 90% 593 95% 647 98% 701 99% 725 100% 891 (longest request)
Prepared by: Khairul Aizat Kamarudzzaman, OSCC MAMPU
Page 65
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
SECTION 5 : REFERENCES
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE IIPhase II : Comparison Report On MySQL and PostgreSQL
REFERENCES
• David Fetter , PostgreSQL Experts Inc <[email protected]>• Arjen Lentz , Open Query <[email protected]>• MySQL Connection strings • Is MySQL really this bad? - Ars Tehnica • MySQL vs. PostgreSQL (2006-October) • Open Source Database Software Comparison • What to consider when moving from MySQL to PostgreSQL • Comparison Matrix • http://www.jonathanboutelle.com/mt/archives/2005/08/mysql_vs_postgr.html • http://www-css.fnal.gov/dsg/external/freeware/pgsql-vs-mysql.html • http://www.devx.com/dbzone/Article/20743 • Critical comparison as wiki from PhiloVivero (2005) • http://www.odesk.com/blog/2009/06/postgresql-vs-mysql/• http://en.wikipedia.org/wiki/Comparison_of_relational_database_management_systems• http://forge.mysql.com/wiki/Main_Page• http://dev.mysql.com/doc/• PostgreSQL Connection strings • Why PostgreSQL Instead of MySQL: Comparing Reliability and Speed in 2007 • Transactional DDL in PostgreSQL: A Competitive Analysis • PostgreSQL vs MySQL with Rails • http://www.vitavoom.com/postgresql.html • http://article.gmane.org/gmane.comp.lang.ruby.rails/12576 • http://www.sitepoint.com/article/site-mysql-postgresql-1 • http://feedlounge.com/blog/2005/11/20/switched-to-postgresql/ • http://www.postgresrocks.com/ • http://www.postgresql.org/docs/• http://2bits.com/articles/benchmarking-postgresql-vs-mysql-performance-using-drupal-5x.html
Page 67