Vous êtes sur la page 1sur 71

MALAYSIAN PUBLIC SECTOR

OPEN SOURCE SOFTWARE (OSS)


PROGRAM

COMPARISON REPORT ON
MySQL and PostgreSQL

NOVEMBER 2009
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

Table of Contents

SECTION 1 : INTRODUCTION.................................................................................................1
EXECUTIVE SUMMARY........................................................................................................2
INTRODUCTION....................................................................................................................2
DISCLAIMER..........................................................................................................................3
SECTION 2 : COMPARISON / EVALUATION TABLE................................................................4
SOFTWARE USE FOR COMPARISON.................................................................................5
SOFTWARE 1 : MySQL.....................................................................................................6
SOFTWARE 2 : PostgreSQL..............................................................................................6
COMPARISON OF FINDING..................................................................................................7
SECTION 3 : DRUPAL BENCHMARKING...............................................................................17
BENCHMARKING DRUPAL ON POSTGRESQL VS. MYSQL........................................18
BENCHMARK SETUP......................................................................................................18
DRUPAL SETUP...............................................................................................................18
POSTGRESQL CONFIGURATION..................................................................................18
CREATING A POSTGRESQL USER AND DATABASE...................................................19
MYSQL CONFIGURATION..............................................................................................19
RUNNING THE BENCHMARKS......................................................................................20
BENCHMARKING METHODOLOGY...............................................................................20
BASH SCRIPT FOR MYSQL.......................................................................................20
BASH SCRIPT FOR POSTGRESQL...........................................................................21
MYSQL RESULTS............................................................................................................21
POSTGRESQL RESULTS................................................................................................21
SECTION 4 : SUMMARY AND CONCLUSIONS......................................................................22
MYSQL AND POSTGRESQL : SUMMARY.....................................................................23
MYSQL AND POSTGRESQL : CONCLUSIONS.............................................................23
APPENDIX A.........................................................................................................................24
MYSQL AND POSTGRESQL : SPEED............................................................................24
MYSQL AND POSTGRESQL : CONCURRENCY OF 1..................................................25
MYSQL AND POSTGRESQL : CONCURRENCY OF 5..................................................25
APPENDIX B........................................................................................................................26
Result from Apache Benchmark for MySQL with concurrency of 1.................................26
Test 1................................................................................................................................26
Test 2............................................................................................................................28
Test 3............................................................................................................................30
Test 4............................................................................................................................32
Test 5............................................................................................................................34
Result from Apache Benchmark for MySQL with concurrency of 5.................................36
Test 1............................................................................................................................36
Test 2............................................................................................................................38
Test 3............................................................................................................................40
Test 4............................................................................................................................42
Test 5............................................................................................................................44
Result from Apache Benchmark for PostgreSQL with concurrency of 1..........................46
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

Test 1............................................................................................................................46
Test 2............................................................................................................................48
Test 3............................................................................................................................50
Test 4............................................................................................................................52
Test 5............................................................................................................................54
Result from Apache Benchmark for PostgreSQL with concurrency of 5..........................56
Test 1............................................................................................................................56
Test 2............................................................................................................................58
Test 3............................................................................................................................60
Test 4............................................................................................................................62
Test 5 ...........................................................................................................................64
SECTION 5 : REFERENCES....................................................................................................66
REFERENCES.....................................................................................................................67

Index of Tables

Table 1: Features Comparison between MySQL and PostgreSQL..........................................15


Table 2: Summary results of concise form................................................................................24
Table 3: Data collection using Mozilla Firefox 3.5.x with YSLOW extension...........................25
Table 4: Refer to Appendix B....................................................................................................26
Table 5: Refer to Appendix B....................................................................................................26
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

SECTION 1 : INTRODUCTION
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

SECTION 2 : COMPARISON / EVALUATION


TABLE
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

COMPARISON OF FINDING
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

FEATURES MySQL PostgreSQL

Raw Speed fast when concurrent access relatively slow at low concurrency
levels are low, and when there levels, but scales well with
are many more reads than increasing load levels, while
writes. On the other hand, it providing enough isolation between
exhibits low scalability with concurrent accesses to avoid
increasing loads and write/read slowdowns at high write/read ratios
ratios (1) (1)

Data Compression supports live compression Support both live compression and
since version 5.0 with the decompression with a fast
ARCHIVE storage engine. compression scheme to fit more
Archive is a write-once, read- data in an allotted disk space. The
many storage engine, designed advantage of compressed data,
for historical data. It besides saving disk space, is that
compresses data up to 90%. It reading data takes less IO, resulting
does not support indexes. In in faster data reads
version 5.1 Archive engine can
be used with partitioning

Support Multi- Yes Yes


Processor
Concurrency focuses on scale-out scales much better, both in terms of
technologies and the use of off- using up-scale hardware, and
the-shelf commodity hardware dealing with concurrency (1)
(1)

Asynchronous I/O lacks Async support, though supports a full fledged


some drivers have been asynchronous API for use by client
created to attempt to overcome applications. It is reported to
this deficiency using Perl and increase performance by up to 40%

Page 8
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

FEATURES MySQL PostgreSQL

Ruby in some cases.


(2)
ACID (Atomicity, Yes Yes (fully compliant)
Consistency, Isolation
and Durability)
Compliance
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, - supports Not-Null, Unique, Primary
Primary Key and Foreign Key Key and Foreign Key constraints
constraints - supports the Check constraint for a
- doesn't supports the Check long time
constraint
Default Values NOW() is the only function that allows for any function marked as
can be used as a default value, IMMUTABLE or STABLE to be used
in a MySQL table as the default value for a column
Support Stored Yes Yes
Procedures
Triggers Yes Yes
Replication and High Yes Yes
Availability
Data Types - does not have network IP - does not have an unsigned integer
address data types that data type, but it has a much richer
PostgreSQL has but does data type support in several
provide INET_ATON() and aspects: standards compliance, the
INET_NTOA() functions to logically fundamental data type
convert IPv4 addresses to and BOOLEAN, user-defined data types

Page 9
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 Yes
(but in some forms can be a
huge performance liability. This
will be corrected in version 6.0)
Partitioning • RANGE • RANGE
• LIST • LIST
• HASH • HASH partitioning is supported
• KEY via immutable functions.

• Composite partitioning using Composite partitioning is also

a combination of RANGE or supported

LIST with HASH or KEY


subpartitions

Data Storage Engines • MyISAM (with full text search • PostgreSQL can have both full
function) text search and transactions,
• InnoDB (with transactions, referential by default
referential, integrity functions
active)
Numbers of Data 9 1

Page 10
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

FEATURES MySQL PostgreSQL

Storage Engines (MySQL functionality is (PostgreSQL has many of MySQL's


Supported extended via differrent usage of Data Storage Engines'
Data Storage Engines) functionalities)
Licensing GPLv2 / Proprietary BSD
Maintainer Sun Microsystems PostgreSQL Global Development
Group
Community Support Yes Yes
Database
Administration Tool phpMyAdmin phpPgAdmin
(Web Based)

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 PostgreSQL supports Hash indexes,
supports Hash indexes though they are never faster than b-
tree indexes
Multiple Indexes MySQL supports multiple PostgreSQL supports multiple
indexes per table and query indexes per query.
since 5.0.
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 II
Phase II : Comparison Report On MySQL and PostgreSQL

FEATURES MySQL PostgreSQL

search, but can only be run on in the tsearch2 module.


the (not transaction safe) PostgreSQL 8.3 integrates tsearch2
MyISAM storage engine. into the core: "TSearch2, our
A 3rd party add-on to MySQL, cutting-edge full text search tool,
Sphinx Fulltext Search Engine has been fully integrated into the
allows it to support full-text core code, and also has a cleaner
searches of InnoDB tables. API."
Partial Indexes MySQL does not support partial PostgreSQL supports partial
indexes. 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 II
Phase 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 With PostgreSQL, prefix indexes
indexes. Prefix indexes cover are a particular case of Expression
the first N characters of a string Indexes
column, making the index much
smaller than one that covers
the entire width of the column,
yet still provide good
performance characteristics.

Multi-column Indexes MySQL is limited to 16 columns PostgreSQL is limited to 32 columns


per index. per index.
Bitmap Indexes MySQL has no bitmap indexes PostgreSQL supports the ability to
but achieves similar combine multiple indexes at query
functionality using its time using bitmap indexes.
"index_merge" feature. Bitmap
indexes will be introduced with
the Falcon engine.
Expression Indexes Expression Indexes can be PostgreSQL allows you to create
emulated in MySQL by adding indexes based on expressions
a precomputed column and (which may include calls to
using a trigger to maintain it. immutable functions). This is very

Page 13
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 Dependent on the storage PostgreSQL supports the ability to
CREATE INDEX engine. Some engines (such as create indexes without locking the
MySQL Cluster and InnoDB table for writes.
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.
Maximum Table Size - 2 GB on Windows 32 TB
- 2 TB on MacOSX with HFS+
- 4 TB on Linux 2.4+ with
ext3FS
- 16 TB on Solaris with ZFS
Maximum Row Size - 65 KB (VarChar / VarBinary) 1.6 TB
- 4 GB (LongTEXT /
LongBLOB)
Maximum Field Size 4 GB 1 GB

Maximum Rows per Unlimited (with InnoDB) Unlimited


Table
Maximum Columns 1000 250 – 1600 depending on column
per Table types

Page 14
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

FEATURES MySQL PostgreSQL

Maximum Indexes per Unlimited Unlimited


Table

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 Yes (with SSL 4.0) Yes
encryption
Brute-force protection No No
Enterprise directory No Yes (LDAP, Kerberos)
compatibility
Password complexity No No
rules
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 II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

SECTION 3 : DRUPAL BENCHMARKING


MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 II
Phase 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
$ psql
ALTER 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 II
Phase 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 II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

SECTION 4 : SUMMARY AND CONCLUSIONS


MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

MYSQL AND POSTGRESQL : SUMMARY

The following table shows a summary of the results in a concise form.


Database MySQL PostgreSQL
Total time taken for front page (milliseconds) 88.57 221.52
Time for front page queries (milliseconds) 10.73 102.16
Total time taken for page with 2000 comments
(milliseconds) 2260.2 2251.5
Concurrency of 1 using Apache Benchmark
(requests per second) 25.09 5.54
Concurrency of 5 using Apache Benchmark
(requests per second) 44.97 11.02
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
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

APPENDIX A

MYSQL AND POSTGRESQL : SPEED

Test Database MySQL PostgreSQL


Total time taken for page with 2000 comments
1 (milliseconds) 2199 2172
Total time taken for page with 2000 comments
2 (milliseconds) 2418 2412
Total time taken for page with 2000 comments
3 (milliseconds) 2223 2190
Total time taken for page with 2000 comments
4 (milliseconds) 2196 2224
Total time taken for page with 2000 comments
5 (milliseconds) 2381 2379
Total time taken for page with 2000 comments
6 (milliseconds) 2393 2186
Total time taken for page with 2000 comments
7 (milliseconds) 2190 2177
Total time taken for page with 2000 comments
8 (milliseconds) 2199 2200
Total time taken for page with 2000 comments
9 (milliseconds) 2209 2218
Total time taken for page with 2000 comments
10 (milliseconds) 2194 2357

Total time taken for page with 2000


Average comments (milliseconds) 2260.2 2251.5

Table 3: Data collection using Mozilla Firefox 3.5.x with YSLOW extension

Page 24
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

MYSQL AND POSTGRESQL : CONCURRENCY OF 1

Test Database MySQL PostgreSQL


Concurrency of 1 using Apache Benchmark
1 25.28 5.49
(requests per second)
Concurrency of 1 using Apache Benchmark
2 25.55 5.46
(requests per second)
Concurrency of 1 using Apache Benchmark
3 24.35 5.54
(requests per second)
Concurrency of 1 using Apache Benchmark
4 25.55 5.62
(requests per second)
Concurrency of 1 using Apache Benchmark
5 24.73 5.61
(requests per second)

Concurrency of 1 using Apache


Average 25.09 5.54
Benchmark (requests per second)
Table 4: Refer to Appendix B

MYSQL AND POSTGRESQL : CONCURRENCY OF 5

Test Database MySQL PostgreSQL


Concurrency of 5 using Apache Benchmark
1 46.57 10.88
(requests per second)
Concurrency of 5 using Apache Benchmark
2 43.85 11.09
(requests per second)
Concurrency of 5 using Apache Benchmark
3 44.21 11.01
(requests per second)
Concurrency of 5 using Apache Benchmark
4 43.86 11.16
(requests per second)
Concurrency of 5 using Apache Benchmark
5 46.38 10.98
(requests per second)

Concurrency of 5 using Apache


Average 44.97 11.02
Benchmark (requests per second)
Table 5: Refer to Appendix B

Page 25
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase 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 II
Phase II : Comparison Report On MySQL and PostgreSQL

SECTION 5 : REFERENCES
MALAYSIAN PUBLIC SECTOR OPEN SOURCE SOFTWARE INITIATIVE PHASE II
Phase II : Comparison Report On MySQL and PostgreSQL

REFERENCES

• David Fetter , PostgreSQL Experts Inc <david.fetter@pgexperts.com>


• Arjen Lentz , Open Query <arjen@openquery.com.au>
• 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

Vous aimerez peut-être aussi