Commit 4d08cfd7 authored by unknown's avatar unknown

Merge


client/mysqlbinlog.cc:
  Auto merged
parents 269e914b 7374310f
...@@ -5002,25 +5002,24 @@ users. ...@@ -5002,25 +5002,24 @@ users.
@cindex PostgreSQL vs. MySQL, overview @cindex PostgreSQL vs. MySQL, overview
When reading the following, please note that both products are When reading the following, please note that both products are continually
continually evolving. We at MySQL AB and the PostgreSQL evolving. We at MySQL AB and the PostgreSQL developers are both working
developers are both working on making our respective database as good as on making our respective database as good as possible, so we are both a
possible, so we are both a serious choice to any commercial database. serious choice to any commercial database.
The following comparison is made by us at MySQL AB. We have tried to be The following comparison is made by us at MySQL AB. We have tried to be
as accurate and fair as possible, but because we don't have a full as accurate and fair as possible, but because we don't have a full
knowledge of all PostgreSQL features while we know MySQL througly, we knowledge of all PostgreSQL features while we know MySQL througly, we
may have got some things wrong. We will however correct these when they may have got some things wrong. We will however correct these when they
come to our attention. come to our attention.
We would first like to note that @code{PostgreSQL} and MySQL We would first like to note that PostgreSQL and MySQL are both widely used
are both widely used products, but with different design goals, even if products, but with different design goals, even if we are both striving to
we are both striving to be ANSI SQL compatible. This means that for be ANSI SQL compatible. This means that for some applications MySQL is
some applications MySQL is more suitable and for others more suited, while for others PostgreSQL is more suited. When choosing
@code{PostgreSQL} is more suitable. When choosing which database to which database to use, you should first check if the database's feature set
use, you should first check if the database's feature set satisfies your satisfies your application. If you need raw speed, MySQL is probably your
application. If you need speed, MySQL is probably your best best choice. If you need some of the extra features that only PostgreSQL
choice. If you need some of the extra features that only @code{PostgreSQL}
can offer, you should use @code{PostgreSQL}. can offer, you should use @code{PostgreSQL}.
@cindex PostgreSQL/MySQL, strategies @cindex PostgreSQL/MySQL, strategies
...@@ -5038,15 +5037,15 @@ When adding things to MySQL we take pride to do an optimal, definite ...@@ -5038,15 +5037,15 @@ When adding things to MySQL we take pride to do an optimal, definite
solution. The code should be so good that we shouldn't have any need to solution. The code should be so good that we shouldn't have any need to
change it in the foreseeable future. We also do not like to sacrifice change it in the foreseeable future. We also do not like to sacrifice
speed for features but instead will do our utmost to find a solution speed for features but instead will do our utmost to find a solution
that will give maximal throughput. This means that development will take that will give maximal throughput. This means that development will take
a little longer, but the end result will be well worth this. This kind a little longer, but the end result will be well worth this. This kind
of development is only possible because all server code are checked by of development is only possible because all server code are checked by
one of a few (currently two) persons before it's included in the one of a few (currently two) persons before it's included in the
MySQL server. MySQL server.
We at MySQL AB believe in frequent releases to be able to push out new We at MySQL AB believe in frequent releases to be able to push out new
features quickly to our users. Because of this we do a new small release features quickly to our users. Because of this we do a new small release
about every 3 weeks, which a major branch every year. All releases are about every three weeks, and a major branch every year. All releases are
throughly tested with our testing tools on a lot of different platforms. throughly tested with our testing tools on a lot of different platforms.
PostgreSQL is based on a kernel with lots of contributors. In this setup PostgreSQL is based on a kernel with lots of contributors. In this setup
...@@ -5057,20 +5056,19 @@ later if there arises a need for this. ...@@ -5057,20 +5056,19 @@ later if there arises a need for this.
Another big difference between MySQL and PostgreSQL is that Another big difference between MySQL and PostgreSQL is that
nearly all of the code in the MySQL server are coded by developers that nearly all of the code in the MySQL server are coded by developers that
are employed by MySQL AB and are still working on the server code. The are employed by MySQL AB and are still working on the server code. The
exceptions are the transaction engines and the regexp library. exceptions are the transaction engines, and the regexp library.
This is in sharp contrast to the PostgreSQL code where the majority of This is in sharp contrast to the PostgreSQL code where the majority of
the code is coded by a big group of people with different backgrounds. the code is coded by a big group of people with different backgrounds.
It was only recently that the PostgreSQL developers announced that they It was only recently that the PostgreSQL developers announced that their
current developer group had finally had time to take a look at all current developer group had finally had time to take a look at all
the code in the current PostgreSQL release. the code in the current PostgreSQL release.
Both of the above development methods has it's own merits and drawbacks. Both of the above development methods has it's own merits and drawbacks.
We here at MySQL AB think of course that our model is better We here at MySQL AB think of course that our model is better because our
because our model gives better code consistence, more optimal and model gives better code consistency, more optimal and reusable code, and
reusable code and, in our opinion, fewer bugs. Because we are the in our opinion, fewer bugs. Because we are the authors of the MySQL server
authors of the MySQL server code we are better able to code, we are better able to coordinate new features and releases.
coordinate new features and releases.
@node MySQL-PostgreSQL features, MySQL-PostgreSQL benchmarks, MySQL-PostgreSQL goals, Compare PostgreSQL @node MySQL-PostgreSQL features, MySQL-PostgreSQL benchmarks, MySQL-PostgreSQL goals, Compare PostgreSQL
...@@ -5082,7 +5080,7 @@ On the @uref{http://www.mysql.com/information/crash-me.php, crash-me} ...@@ -5082,7 +5080,7 @@ On the @uref{http://www.mysql.com/information/crash-me.php, crash-me}
page you can find a list of those database constructs and limits that page you can find a list of those database constructs and limits that
one can detect automatically with a program. Note however that a lot of one can detect automatically with a program. Note however that a lot of
the numerical limits may be changed with startup options for respective the numerical limits may be changed with startup options for respective
database. The above web page is however extremely useful when you want to database. The above web page is however extremely useful when you want to
ensure that your applications works with many different databases or ensure that your applications works with many different databases or
when you want to convert your application from one datbase to another. when you want to convert your application from one datbase to another.
...@@ -5092,203 +5090,230 @@ MySQL offers the following advantages over PostgreSQL: ...@@ -5092,203 +5090,230 @@ MySQL offers the following advantages over PostgreSQL:
@item @item
@code{MySQL} is generally much faster than PostgreSQL. @code{MySQL} is generally much faster than PostgreSQL.
@xref{MySQL-PostgreSQL benchmarks}. @xref{MySQL-PostgreSQL benchmarks}.
@item @item
Because MySQL has a much larger user base than PostgreSQL the MySQL has a much larger user base than PostgreSQL, therefor the
code is more tested and has historically been more stable than code is more tested and has historically been more stable than
PostgreSQL. MySQL is the much more used in production PostgreSQL. MySQL is the much more used in production
environments than PostgreSQL, mostly thanks to that MySQL AB, environments than PostgreSQL, mostly thanks to that MySQL AB,
former TCX DataKonsult AB, has provided top quality commercial support formerly TCX DataKonsult AB, has provided top quality commercial support
for MySQL from the day it was released, whereas until recently for MySQL from the day it was released, whereas until recently
PostgreSQL was unsupported. PostgreSQL was unsupported.
@item @item
MySQL works on more platforms than PostgreSQL. @xref{Which OS}. MySQL works on more platforms than PostgreSQL. @xref{Which OS}.
@item @item
MySQL works better on Windows; MySQL is running as a MySQL works better on Windows than PostgreSQL does. MySQL runs as a
native windows application (a service on NT/Win2000/WinXP), while native Windows application (a service on NT/Win2000/WinXP), while
PostgreSQL is run under the cygwin emulation. We have heard that PostgreSQL is run under the cygwin emulation. We have heard that
PostgreSQL is not yet that stable on windows but we haven't been able to PostgreSQL is not yet that stable on Windows but we haven't been able to
verify this ourselves. verify this ourselves.
@item @item
MySQL has more API to other languages and is supported by more MySQL has more APIs to other languages and is supported by more
programs than PostgreSQL. @xref{Contrib}. existing programs than PostgreSQL. @xref{Contrib}.
@item @item
MySQL works on 24/7 heavy duty systems. In most circumstances MySQL works on 24/7 heavy duty systems. In most circumstances
you never have to run any cleanups on @code{MySQL}. PostgreSQL doesn't you never have to run any cleanups on @code{MySQL}. PostgreSQL doesn't
yet support 24/7 systems because you have have to run @code{vacuum()} yet support 24/7 systems because you have to run @code{vacuum()}
once in a while to reclaim space from @code{UPDATE} and @code{DELETE} once in a while to reclaim space from @code{UPDATE} and @code{DELETE}
commands and to perform statistics analyzes that are critical to get commands and to perform statistics analyzes that are critical to get
good performance with PostgreSQL. Vacuum is also needed after adding good performance with PostgreSQL. Vacuum is also needed after adding
a lot of new rows to a table. On a busy system with lots of changes a lot of new rows to a table. On a busy system with lots of changes,
vacuum must be run very frequently, in the worst cases even many times a vacuum must be run very frequently, in the worst cases even many times a
day. During the @code{vacuum()} run, which may take hours if the day. During the @code{vacuum()} run, which may take hours if the
database is big, the database is from a production standpoint database is big, the database is from a production standpoint,
practically dead. The PostgreSQL team has fixing this on their TODO, practically dead. The PostgreSQL team has fixing this on their TODO,
but we assume that this is not an easy thing to fix permanently. but we assume that this is not an easy thing to fix permanently.
@item @item
A working, tested replication feature used by sites like A working, tested replication feature used by sites like
@uref{http://finance.yahoo.com, Yahoo finance}, @itemize @minus
@uref{http://www.mobile.de/,mobile.de} and @item Yahoo Finance (@uref{http://finance.yahoo.com})
@uref{http://www.slashdot.org,Slashdot}. @item Mobile.de (@uref{http://www.mobile.de/})
@item @item Slashdot (@uref{http://www.slashdot.org})
Included in the MySQL distribution is included two different @end itemize
testing suits (@file{mysql-test-run} and
@uref{http://www.mysql.com/information/crash-me.php,crash-me}) and a @item
benchmark suite. The test system is actively updated with code to test Included in the MySQL distribution are two different testing suites,
each new feature and almost all repeatable bugs that comes to our @file{mysql-test-run} and
attention. We test MySQL with these on a lot of platforms @uref{http://www.mysql.com/information/crash-me.php,crash-me}, as well
before every release. These tests are more sofisticated than anything as a benchmark suite. The test system is actively updated with code to
have seen from PostgreSQL and ensures that the MySQL code keeps test each new feature and almost all repeatable bugs that have come to
at a high standard. our attention. We test MySQL with these on a lot of platforms before
@item every release. These tests are more sophisticated than anything we have
There are far moore books in print on MySQL than on PostgreSQL. seen from PostgreSQL, and they ensures that the MySQL is kept to a high
standard.
@item
There are far more books in print about MySQL than about PostgreSQL.
O'Reilly, Sams, Que, and New Riders are all major publishers with books O'Reilly, Sams, Que, and New Riders are all major publishers with books
about MySQL. All MySQL features is also documented in the about MySQL. All MySQL features are also documented in the MySQL on-line
MySQL on-line manual because when a feature is implemented, the manual, because when a new feature is implemented, the MySQL developers
MySQL developers are required to document it before it's are required to document it before it's included in the source.
included in the source.
@item @item
MySQL has supports more of the standard ODBC functions than MySQL supports more of the standard ODBC functions than @code{PostgreSQL}.
@code{PostgreSQL}.
@item @item
MySQL has a much more sophisticated @code{ALTER TABLE}. MySQL has a much more sophisticated @code{ALTER TABLE}.
@item @item
MySQL has support for tables without transactions for MySQL has support for tables without transactions for applications that
applications that need all speed they can get. The tables may be memory need all speed they can get. The tables may be memory based, @code{HEAP}
based,@code{HEAP} tables or disk based @code{MyISAM}. @xref{Table types}. tables or disk based @code{MyISAM}. @xref{Table types}.
@item @item
MySQL has support for 3 different table handles that support MySQL has support for two different table handlers that support
transactions (@code{BDB} and @code{InnoDB}). Because transactions, @code{BerkeleyDB} and @code{InnoDB}. Because every
every transaction engine performs differently under different transaction engine performs differently under different conditions, this
conditions, this gives the application writer more options to find an gives the application writer more options to find an optimal solution for
optimal solution for his/her setup. @xref{Table types}. his or her setup. @xref{Table types}.
@item @item
@code{MERGE} tables gives you a unique way to instantly make a view over @code{MERGE} tables gives you a unique way to instantly make a view over
a set of identical tables and use these as one. This is perfectly for a set of identical tables and use these as one. This is perfect for
systems where you have log files that you order for example by month. systems where you have log files that you order for example by month.
@xref{MERGE}. @xref{MERGE}.
@item @item
The option to compress read-only tables, but still have direct access to The option to compress read-only tables, but still have direct access to
the rows in the table, gives you better performance by minimizing disk the rows in the table, gives you better performance by minimizing disk
reads. This is very useful when you are archiving reads. This is very useful when you are archiving things.
things.@xref{myisampack}. @xref{myisampack}.
@item @item
MySQL has internal support for text search. @xref{Fulltext Search}. MySQL has internal support for fulltext search. @xref{Fulltext Search}.
@item @item
You can access many databases from the same connection (depending of course You can access many databases from the same connection (depending of course
on your privileges). on your privileges).
@item @item
MySQL is coded from the start with multi-threading while MySQL is coded from the start to be multi-threaded while PostgreSQL uses
PostgreSQL uses processes. Because context switching and access to processes. Context switching and access to common storage areas is much
common storage areas is much faster between threads, than are separate faster between threads than between separate processes, this gives MySQL
processes, this gives MySQL a big speed advantage in multi-user a big speed advantage in multi-user applications and also makes it easier
applications and also makes it easier for MySQL to take full for MySQL to take full advantage of symmetric multiprocessor (SMP) systems.
advantage of symmetric multiprocessor systems (SMP).
@item @item
MySQL has a much more sophisticated privilege system than MySQL has a much more sophisticated privilege system than PostgreSQL.
PostgreSQL. While PostgreSQL only supports @code{INSERT}, While PostgreSQL only supports @code{INSERT}, @code{SELECT}, and
@code{SELECT}, @code{update/delete} grants per user on a database or a @code{UPDATE/DELETE} grants per user on a database or a table, MySQL allows
table MySQL allows you to define a full set of different you to define a full set of different privileges on database, table and
privileges on database, table and columns level. MySQL also allows column level. MySQL also allows you to specify the privilege on host and
you to specify the privilege on host+user combinations. @xref{GRANT}. user combinations. @xref{GRANT}.
@item
MySQL supports a compressed server/client protocol which @item
improves performance over slow links. MySQL supports a compressed client/server protocol which improves
@item performance over slow links.
MySQL employs the table handler concept and is the only
relational database we know of built around this concept. This allows @item
different low level table types to be swapped into the SQL engine, each MySQL employs a ``table handler'' concept, and is the only relational
table type optimized for a different performance characteristics. database we know of built around this concept. This allows different
@item low-level table types to be swapped into the SQL engine, and each table
All @code{MySQL} table types (except @strong{InnoDB}) are implemented as type can be optimized for different performance characteristics.
files (ie: one table per file), which makes it really easy to backup,
move, delete and even symlink databases and tables when the server is @item
down. All MySQL table types (except @strong{InnoDB}) are implemented as files
(one table per file), which makes it really easy to backup, move, delete
and even symlink databases and tables, even when the server is down.
@item @item
Tools to repair and optimize @strong{MyISAM} tables (the most common Tools to repair and optimize @strong{MyISAM} tables (the most common
MySQL table type). A repair tool is only needed when a MySQL table type). A repair tool is only needed when a physical corruption
physical corruption of a data file happens, usually from a hardware of a data file happens, usually from a hardware failure. It allows a
failure. It allows a majority of the data to be recovered. majority of the data to be recovered.
@item @item
Upgrading MySQL is painless. When you are upgrading MySQL, Upgrading MySQL is painless. When you are upgrading MySQL, you don't need
you don't need to dump/restore your data, as you have to do with most to dump/restore your data, as you have to do with most PostgreSQL upgrades.
PostgreSQL upgrades.
@end itemize @end itemize
Drawbacks with MySQL compared to PostgreSQL: Drawbacks with MySQL compared to PostgreSQL:
@itemize @bullet @itemize @bullet
@item @item
The transaction support in MySQL is not yet as well tested as The transaction support in MySQL is not yet as well tested as PostgreSQL's
PostgreSQL's system. system.
@item @item
Because MySQL uses threads, which are still a moving target on Because MySQL uses threads, which are not yet flawless on many OSes, one
many OS, one must either use binaries from must either use binaries from @uref{http://www.mysql.com/downloads}, or
@uref{http://www.mysql.com/downloads} or carefully follow our carefully follow our instructions on
instructions on
@uref{http://www.mysql.com/doc/I/n/Installing_source.html} to get an @uref{http://www.mysql.com/doc/I/n/Installing_source.html} to get an
optimal binary that works in all cases. optimal binary that works in all cases.
@item @item
Table locking, as used by the non-transactional @code{MyISAM} tables, is Table locking, as used by the non-transactional @code{MyISAM} tables, is
in many cases faster than page locks, row locks or versioning. The in many cases faster than page locks, row locks or versioning. The
drawback however is that if one doesn't take into account how table drawback however is that if one doesn't take into account how table
locks works, a single long-running query can block a table for updates locks work, a single long-running query can block a table for updates
for a long time. This can usable be avoided when designing the for a long time. This can usable be avoided when designing the
application. If not, one can always switch the trouble table to use one application. If not, one can always switch the trouble table to use one
of the transactional table types. @xref{Table locking}. of the transactional table types. @xref{Table locking}.
@item @item
With UDF (user defined functions) one can extend MySQL with With UDF (user defined functions) one can extend MySQL with both normal
both normal SQL functions and aggregates, but this is not as easy or as SQL functions and aggregates, but this is not yet as easy or as flexible
flexible as in PostgreSQL. @xref{Adding functions}. as in PostgreSQL. @xref{Adding functions}.
@item @item
Updates and deletes that goes over multiple tables is harder to do in Updates and deletes that run over multiple tables is harder to do in
MySQL. (Will be fixed in MySQL 4.0 with multi-table MySQL. This will, hoever, be fixed in MySQL 4.0 with multi-table
@code{DELETE} and multi-table @code{UPDATE} and in MySQL 4.1 @code{DELETE} and multi-table @code{UPDATE} and in MySQL 4.1
with @code{SUB-SELECT}) with subselects.
@end itemize @end itemize
PostgreSQL offers currently the following advantages over MySQL: PostgreSQL currently offers the following advantages over MySQL:
Note that because we know the MySQL road map, we have included Note that because we know the MySQL road map, we have included in the
in the following table the version when MySQL should support following table the version when MySQL should support this feature.
this feature. Unfortunately we couldn't do this for previous comparison, Unfortunately we couldn't do this for previous comparison, because we
because we don't know the PostgreSQL roadmap. don't know the PostgreSQL roadmap.
@multitable @columnfractions .70 .30 @multitable @columnfractions .70 .30
@item @strong{Feature} @tab @strong{MySQL version} @item @strong{Feature} @tab @strong{MySQL version}
@item Subselects @tab 4.1 @item Subselects @tab 4.1
@item Foreign keys @tab 4.0 and 4.1 @item Foreign keys @tab 4.0 and 4.1
@item Views. @tab 4.2 @item Views @tab 4.2
@item Stored procedures in multiple languages @tab 4.1 @item Stored procedures @tab 4.1
@item Extensible type system. @tab Not planed @item Extensible type system @tab Not planned
@item Unions @tab 4.0. @item Unions @tab 4.0
@item Full join. @tab 4.0 or 4.1. @item Full join @tab 4.0 or 4.1
@item Triggers. @tab 4.1 @item Triggers @tab 4.1
@item Constrainst @tab 4.1 @item Constrainst @tab 4.1
@item Cursors @tab 4.1 or 4.2 @item Cursors @tab 4.1 or 4.2
@item Extensible index types like R-trees @tab R-trees are planned to 4.2 @item Extensible index types like R-trees @tab R-trees are planned for 4.2
@item Inherited tables @tab Not planned @item Inherited tables @tab Not planned
@end multitable @end multitable
Other reasons to use PostgreSQL: Other reasons to use PostgreSQL:
@itemize @bullet @itemize @bullet
@item @item
Standard usage is in PostgreSQL closer to ANSI SQL in some cases. Standard usage in PostgreSQL is closer to ANSI SQL in some cases.
@item @item
One can get speed up PostgreSQL by coding things as stored procedures. One can speed up PostgreSQL by coding things as stored procedures.
@item @item
Bigger team of developers that contributes to the server. PostgreSQL has a bigger team of developers that contribute to the server.
@end itemize @end itemize
Drawbacks with PostgreSQL compared to MySQL: Drawbacks with PostgreSQL compared to MySQL:
@itemize @bullet @itemize @bullet
@item @item
@code{Vaccum()} makes PostgreSQL hard to use in a 24/7 environment. @code{VACUUM()} makes PostgreSQL hard to use in a 24/7 environment.
@item @item
Only transactional tables. Only transactional tables.
@item @item
Much slower insert/delete/update. Much slower @code{INSERT}, @code{DELETE}, and @code{UPDATE}.
@end itemize @end itemize
For a complete list of drawbacks, you should also examine the first table For a complete list of drawbacks, you should also examine the first table
...@@ -5304,88 +5329,83 @@ in this section. ...@@ -5304,88 +5329,83 @@ in this section.
@cindex PostgreSQL vs. MySQL, benchmarks @cindex PostgreSQL vs. MySQL, benchmarks
The only open source benchmark, that we know of, that can be used to The only open source benchmark that we know of that can be used to
benchmark MySQL and PostgreSQL (and other databases) is our benchmark MySQL and PostgreSQL (and other databases) is our own. It can
own. It can be found at: be found at @uref{http://www.mysql.com/information/benchmarks.html}.
@uref{http://www.mysql.com/information/benchmarks.html}.
We have many times asked the PostgreSQL developers and some PostgreSQL We have many times asked the PostgreSQL developers and some PostgreSQL
users to help us extend this benchmark to make the definitive benchmark users to help us extend this benchmark to make it the definitive benchmark
for databases, but unfortunately we haven't got any feedback for this. for databases, but unfortunately we haven't gotten any feedback for this.
We, the MySQL developers, have because of this spent a lot of We the MySQL developers have, because of this, spent a lot of hours to get
hours to get maximum performance from PostgreSQL for the benchmarks, but maximum performance from PostgreSQL for the benchmarks, but because we
because we don't know PostgreSQL intimately we are sure that there are don't know PostgreSQL intimately, we are sure that there are things that
things that we have missed. We have on the benchmark page documented we have missed. We have on the benchmark page documented exactly how we
exactly how we did run the benchmark so that it should be easy for did run the benchmark so that it should be easy for anyone to repeat and
anyone to repeat and verify our results. verify our results.
The benchmarks are usually run with and without the @code{--fast} The benchmarks are usually run with and without the @code{--fast} option.
option. When run with @code{--fast} we are trying to use every trick When run with @code{--fast} we are trying to use every trick the server can
the server can do to get the code to execute as fast as possible. do to get the code to execute as fast as possible. The idea is that the
The idea is that the normal run should show how the server would work in normal run should show how the server would work in a default setup and
a default setup and the @code{--fast} run shows how the server would do the @code{--fast} run shows how the server would do if the application
if the application developer would use extensions in the server to make developer would use extensions in the server to make his application run
his application run faster. faster.
When running with PostgreSQL and @code{--fast} we do a @code{vacuum()} When running with PostgreSQL and @code{--fast} we do a @code{VACUUM()}
between after every major table update and drop table to make the database after every major table @code{UPDATE} and @code{DROP TABLE} to make the
in perfect shape for the following selects. The time for vacuum() is database in perfect shape for the following @code{SELECT}s. The time for
measured separately. @code{VACUUM()} is measured separately.
When running with PostgreSQL 7.1.1 we could however not run with When running with PostgreSQL 7.1.1 we could, however, not run with
@code{--fast} because during the insert test, the postmaster (the @code{--fast} because during the @code{INSERT} test, the postmaster (the
PostgreSQL deamon) died and the database was so corrupted that it was PostgreSQL deamon) died and the database was so corrupted that it was
impossible to restart postmaster. (The details about the machine we run impossible to restart postmaster. After this happened twice, we decided
the benchmark can be found on the benchmark page). After this happened to postpone the @code{--fast} test until next PostgreSQL release. The
twice, we decided to postpone the @code{--fast} test until next details about the machine we run the benchmark can be found on the
PostgreSQL release. benchmark page.
Before going to the other benchmarks we know of, We would like to give Before going to the other benchmarks we know of, we would like to give
some background to benchmarks: some background on benchmarks:
It's very easy to write a test that shows ANY database to be best It's very easy to write a test that shows ANY database to be best
database in the world, by just restricting the test to something the database in the world, by just restricting the test to something the
database is very good at and not test anything that the database is not database is very good at and not test anything that the database is not
good at; If one after this publish the result with a single figure good at. If one after this publishes the result with a single figure,
things is even easier. things are even easier.
This would be like we would measure the speed of MySQL compared This would be like us measuring the speed of MySQL compared to PostgreSQL
to PostgreSQL by looking at the summary time of the MySQL benchmarks on by looking at the summary time of the MySQL benchmarks on our web page.
our web page. Based on this MySQL would be more than 40 times Based on this MySQL would be more than 40 times faster than PostgreSQL,
faster than PostgreSQL, something that is of course not true. We could something that is of course not true. We could make things even worse
make things even worse by just taking the test where PostgreSQL performs by just taking the test where PostgreSQL performs worst and claim that
worst and claim that MySQL is more than 2000 times faster than MySQL is more than 2000 times faster than PostgreSQL.
PostgreSQL.
The case is that MySQL does a lot of optimizations that PostgreSQL doesn't
The case is that MySQL does a lot of optimizations that do and the other way around. An SQL optimizer is a very complex thing, and
PostgreSQL doesn't do and the other way around. An SQL optimizer is a a company could spend years on just making the optimizer faster and faster.
very complex thing and a company could spend years on just making the
optimizer faster and faster.
When looking at the benchmark results you should look for things that When looking at the benchmark results you should look for things that
you do in your application and just use these results to decide which you do in your application and just use these results to decide which
database would be best suited for your application. The benchmark database would be best suited for your application. The benchmark
results also shows things a particular database is not good at and should results also shows things a particular database is not good at and should
give you a notion about things to avoid and what you may have to do in give you a notion about things to avoid and what you may have to do in
other ways. other ways.
We know of two benchmark tests that claims that PostgreSQL performers We know of two benchmark tests that claims that PostgreSQL performs better
better than MySQL. These both where multi-user tests, a test than MySQL. These both where multi-user tests, a test that we here at
that we here at MySQL AB haven't had time to write and include in MySQL AB haven't had time to write and include in the benchmark suite,
the benchmark suite, mainly because it's a big task to do this in a mainly because it's a big task to do this in a manner that is fair against
manner that is fair against all databases. all databases.
One is the benchmark paid for by One is the benchmark paid for by Great Bridge, which you can read about at:
@uref{http://www.greatbridge.com/about/press.php?content_id=4,Great @uref{http://www.greatbridge.com/about/press.php?content_id=4}.
Bridge}.
This is the worst benchmark we have ever seen anyone ever conduct. This This is the probably worst benchmark we have ever seen anyone conduct. This
was not only tuned to only test what PostgreSQL is absolutely best at, was not only tuned to only test what PostgreSQL is absolutely best at, it
it was also totally unfair against every other database involved in the was also totally unfair against every other database involved in the test.
test.
@strong{NOTE}: We know that not even some of the main PostgreSQL @strong{NOTE}: We know that not even some of the main PostgreSQL
developers did like the way Great Bridge conducted the benchmark, so we developers did like the way Great Bridge conducted the benchmark, so we
don't blame them for the way the benchmark was made. don't blame them for the way the benchmark was made.
...@@ -5394,98 +5414,115 @@ we will here just shortly repeat some things that where wrong with it. ...@@ -5394,98 +5414,115 @@ we will here just shortly repeat some things that where wrong with it.
@itemize @bullet @itemize @bullet
@item @item
The tests where run with an expensive commercial tool, that makes it The tests were run with an expensive commercial tool, that makes it
impossible for an open source company like us to verify the benchmarks, impossible for an open source company like us to verify the benchmarks,
or even check how the benchmark where really done. The tool is not even or even check how the benchmarks were really done. The tool is not even
a true benchmark tool, but a application/setup testing tool. To refer a true benchmark tool, but an application/setup testing tool. To refer
this as STANDARD benchmark tool is to stretch the truth a long way. this as a ``standard'' benchmark tool is to stretch the truth a long way.
@item @item
Great Bridge admitted that they had optimized the PostgreSQL database Great Bridge admitted that they had optimized the PostgreSQL database
(with vacuum() before the test) and tuned the startup for the tests, (with @code{VACUUM()} before the test) and tuned the startup for the tests,
something they hadn't done for any of the other databases involved. To something they hadn't done for any of the other databases involved. To
say "This process optimizes indexes and frees up disk space a bit. The say ``This process optimizes indexes and frees up disk space a bit. The
optimized indexes boost performance by some margin". Our benchmarks optimized indexes boost performance by some margin.'' Our benchmarks
clearly indicates that the difference in running a lot of selects on a clearly indicate that the difference in running a lot of selects on a
database with and without vacuum() can easily differ by a factor of 10. database with and without @code{VACUUM()} can easily differ by a factor
of ten.
@item @item
The test results where also strange; The AS3AP test documentation The test results were also strange. The AS3AP test documentation
mentions that the test does: mentions that the test does ``selections, simple joins, projections,
aggregates, one-tuple updates, and bulk updates''.
"selections, simple joins, projections, aggregates, one-tuple updates, PostgreSQL is good at doing @code{SELECT}s and @code{JOIN}s (especially
and bulk updates" after a @code{VACUUM()}), but doesn't perform as well on @code{INSERT}s or
@code{UPDATE}s. The benchmarks seem to indicate that only @code{SELECT}s
were done (or very few updates). This could easily explain they good results
for PostgreSQL in this test. The bad results for MySQL will be obvious a
bit down in this document.
PostgreSQL is good at doing selects and joins (especially after a
vacuum()), but doesn't perform as well on inserts/updates; The
benchmarks seem to indicate that only SELECTs where done (or very few
updates) . This could easily explain they good results for PostgreSQL in
this test. The bad results for MySQL will be obvious a bit down in this
document.
@item @item
They did run the so called benchmark from a Windows machine against a They did run the so-called benchmark from a Windows machine against a
Linux machine over ODBC, a setup that no normal database user would ever Linux machine over ODBC, a setup that no normal database user would ever
do when running a heavy multi-user application. This tested more the do when running a heavy multi-user application. This tested more the
ODBC driver and the Windows protocol used between the clients than the ODBC driver and the Windows protocol used between the clients than the
database itself. database itself.
@item @item
When running the database against Oracle and MS-SQL (Great Bridge has When running the database against Oracle and MS-SQL (Great Bridge has
indirectly indicated that the databases they used in the test), indirectly indicated that the databases they used in the test), they
they didn't use the native protocol but instead ODBC. Anyone that has didn't use the native protocol but instead ODBC. Anyone that has ever
ever used Oracle, knows that all real application uses the native used Oracle knows that all real application uses the native interface
interface instead of ODBC. Doing a test through ODBC and claiming that instead of ODBC. Doing a test through ODBC and claiming that the results
the results had anything to do with using the database for real can't had anything to do with using the database in a real-world situation can't
be regarded as fair play. They should have done two tests with and be regarded as fair. They should have done two tests with and without ODBC
without ODBC to provide the right facts (after having got experts to tune to provide the right facts (after having got experts to tune all involved
all involved databases of course). databases of course).
@item
They refer to the TPC-C tests, but doesn't anywhere mention that the @item
tests they did where not a true TPC-C test and they where not even They refer to the TPC-C tests, but they don't mention anywhere that the
allowed to call it a TPC-C test. A TPC-C test can only be conducted by test they did was not a true TPC-C test and they were not even allowed to
the rules approved by the @uref{http://www.tpc.org,TPC-council}. Great call it a TPC-C test. A TPC-C test can only be conducted by the rules
Bridge didn't do that. By doing this they have both violated the TPC approved by the TPC Council (@uref{http://www.tpc.org}). Great Bridge
trademark and miscredited their own benchmarks. The rules set by the didn't do that. By doing this they have both violated the TPC trademark
TPC-council are very strict to ensure that no one can produce false and miscredited their own benchmarks. The rules set by the TPC Council
results or make unprovable statements. Apparently Great Bridge wasn't are very strict to ensure that no one can produce false results or make
interested in doing this. unprovable statements. Apparently Great Bridge wasn't interested in
doing this.
@item @item
After the first test, we contacted Great Bridge and mentioned to them After the first test, we contacted Great Bridge and mentioned to them
some of the obvious mistakes they had done with MySQL; Running some of the obvious mistakes they had done with MySQL:
with a debug version of our ODBC driver, running on a Linux system that
wasn't optimized for threads, using an old MySQL version when there was @itemize @minus
a recommended newer one available, not starting MySQL with the @item
right options for heavy multi-user use (the default installation of Running with a debug version of our ODBC driver
MySQL is tuned for minimal resource use). Great Bridge did run a new
test, with our optimized ODBC driver and with better startup options for @item
MySQL, but refused to either use our updated glibc library or our Running on a Linux system that wasn't optimized for threads
standard binary (used by 80% of our users), which was statically linked
with a fixed glibc library. @item
Using an old MySQL version when there was a recommended newer one available
@item
Not starting MySQL with the right options for heavy multi-user use (the
default installation of MySQL is tuned for minimal resource use).
@end itemize
Great Bridge did run a new test, with our optimized ODBC driver and with
better startup options for MySQL, but refused to either use our updated
glibc library or our standard binary (used by 80% of our users), which was
statically linked with a fixed glibc library.
According to what we know, Great Bridge did nothing to ensure that the According to what we know, Great Bridge did nothing to ensure that the
other databases where setup correctly to run good in their test other databases were set up correctly to run well in their test
environment. We are sure however that they didn't contact Oracle or environment. We are sure however that they didn't contact Oracle or
Microsoft to ask for their advice in this matter ;) Microsoft to ask for their advice in this matter ;)
@item @item
The benchmark was paid for by Great Bridge, and they decided to publish The benchmark was paid for by Great Bridge, and they decided to publish
only partial chosen results (instead of publishing it all). only partial, chosen results (instead of publishing it all).
@end itemize @end itemize
Tim Perdue, a long time PostgreSQL fan and a reluctant MySQL user Tim Perdue, a long time PostgreSQL fan and a reluctant MySQL user
published a comparison on published a comparison on
@uref{http://www.phpbuilder.com/columns/tim20001112.php3,phpbuider}. @uref{http://www.phpbuilder.com/columns/tim20001112.php3,phpbuider}.
When we got aware of the comparison, we phoned Tim Perdue about this When we became aware of the comparison, we phoned Tim Perdue about this
because there was a lot of strange things in his results. For example, because there were a lot of strange things in his results. For example,
he claimed that MySQL had a problem with five users in his tests, when we he claimed that MySQL had a problem with five users in his tests, when we
know that there are users with similar machines as his that are using know that there are users with similar machines as his that are using
MySQL with 2000 simultaneous connections doing 400 queries per second (In MySQL with 2000 simultaneous connections doing 400 queries per second.
this case the limit was the web bandwidth, not the database). (In this case the limit was the web bandwidth, not the database.)
It sounded like he was using a Linux kernel that either had some It sounded like he was using a Linux kernel that either had some
problems with many threads (Linux kernels before 2.4 had a problem with problems with many threads, such as kernels before 2.4, which had a problem
this but we have documented how to fix this and Tim should be aware of with this but we have documented how to fix this and Tim should be aware of
this problem). The other possible problem could have been an old glibc this problem. The other possible problem could have been an old glibc
library and that Tim didn't use a MySQL binary from our site, which is library and that Tim didn't use a MySQL binary from our site, which is
linked with a corrected glibc library, but had compiled a version of his linked with a corrected glibc library, but had compiled a version of his
own with. In any of the above cases, the symptom would have been exactly own with. In any of the above cases, the symptom would have been exactly
what Tim had measured. what Tim had measured.
We asked Tim if we could get access to his data so that we could repeat We asked Tim if we could get access to his data so that we could repeat
...@@ -5498,26 +5535,25 @@ Because of this we can't put any trust in this benchmark either :( ...@@ -5498,26 +5535,25 @@ Because of this we can't put any trust in this benchmark either :(
Conclusion: Conclusion:
The only benchmarks that exist today that anyone can download and run The only benchmarks that exist today that anyone can download and run
against MySQLand PostgreSQL is the MySQL benchmarks. We here against MySQL and PostgreSQL is the MySQL benchmarks. We here at MySQL
at MySQL believe that open source databases should be tested believe that open source databases should be tested with open source tools!
with open source tools! This is the only way to ensure that no one This is the only way to ensure that no one does tests that nobody can
does tests that nobody can reproduce and use this to claim that a reproduce and use this to claim that a database is better than another.
database is better than another. Without knowing all the facts it's Without knowing all the facts it's impossible to answer the claims of the
impossible to answer the claims of the tester. tester.
The thing we find strange is that every test we have seen about The thing we find strange is that every test we have seen about
PostgreSQL, that is impossible to reproduce, claims that PostgreSQL is PostgreSQL, that is impossible to reproduce, claims that PostgreSQL is
better in most cases while our tests, which anyone can reproduce, better in most cases while our tests, which anyone can reproduce,
clearly shows otherwise. With this we don't want to say that PostgreSQL clearly shows otherwise. With this we don't want to say that PostgreSQL
isn't good at many things (It is!) We would just like to see a fair test isn't good at many things (it is!). We would just like to see a fair test
where they are very good so that we could get some friendly competition where they are very good so that we could get some friendly competition
going! going!
For more information about our benchmarks suite see @xref{MySQL For more information about our benchmarks suite @xref{MySQL Benchmarks}.
Benchmarks}.
We are working on an even better benchmark suite, including much better We are working on an even better benchmark suite, including much better
documentation of what the individual tests really do and how to add more documentation of what the individual tests really do, and how to add more
tests to the suite. tests to the suite.
...@@ -9617,7 +9653,7 @@ thread stacks to stay away from the global heap. With @code{mysqld}, you ...@@ -9617,7 +9653,7 @@ thread stacks to stay away from the global heap. With @code{mysqld}, you
should enforce this "gentleman" behavior by setting a reasonable value for should enforce this "gentleman" behavior by setting a reasonable value for
the @code{max_connections} variable. the @code{max_connections} variable.
If you build MySQL yourself and do not what to mess with patching If you build MySQL yourself and do not want to mess with patching
LinuxThreads, you should set @code{max_connections} to a value no higher LinuxThreads, you should set @code{max_connections} to a value no higher
than 500. It should be even less if you have a large key buffer, large than 500. It should be even less if you have a large key buffer, large
heap tables, or some other things that make @code{mysqld} allocate a lot heap tables, or some other things that make @code{mysqld} allocate a lot
...@@ -25079,21 +25115,27 @@ when the first row in t2 is found. ...@@ -25079,21 +25115,27 @@ when the first row in t2 is found.
@item @item
The table @code{B} is set to be dependent on table @code{A} and all tables The table @code{B} is set to be dependent on table @code{A} and all tables
that @code{A} is dependent on. that @code{A} is dependent on.
@item @item
The table @code{A} is set to be dependent on all tables (except @code{B}) The table @code{A} is set to be dependent on all tables (except @code{B})
that are used in the @code{LEFT JOIN} condition. that are used in the @code{LEFT JOIN} condition.
@item @item
All @code{LEFT JOIN} conditions are moved to the @code{WHERE} clause. All @code{LEFT JOIN} conditions are moved to the @code{WHERE} clause.
@item @item
All standard join optimizations are done, with the exception that a table is All standard join optimizations are done, with the exception that a table is
always read after all tables it is dependent on. If there is a circular always read after all tables it is dependent on. If there is a circular
dependence then MySQL will issue an error. dependence then MySQL will issue an error.
@item @item
All standard @code{WHERE} optimizations are done. All standard @code{WHERE} optimizations are done.
@item @item
If there is a row in @code{A} that matches the @code{WHERE} clause, but there If there is a row in @code{A} that matches the @code{WHERE} clause, but there
wasn't any row in @code{B} that matched the @code{LEFT JOIN} condition, wasn't any row in @code{B} that matched the @code{LEFT JOIN} condition,
then an extra @code{B} row is generated with all columns set to @code{NULL}. then an extra @code{B} row is generated with all columns set to @code{NULL}.
@item @item
If you use @code{LEFT JOIN} to find rows that don't exist in some If you use @code{LEFT JOIN} to find rows that don't exist in some
table and you have the following test: @code{column_name IS NULL} in the table and you have the following test: @code{column_name IS NULL} in the
...@@ -25116,8 +25158,8 @@ Note that the above means that if you do a query of type: ...@@ -25116,8 +25158,8 @@ Note that the above means that if you do a query of type:
SELECT * FROM a,b LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key SELECT * FROM a,b LEFT JOIN c ON (c.key=a.key) LEFT JOIN d (d.key=a.key) WHERE b.key=d.key
@end example @end example
MySQL will do a full scan on @code{b} as the @code{LEFT MySQL will do a full scan on @code{b} as the @code{LEFT JOIN} will force
JOIN} will force it to be read before @code{d}. it to be read before @code{d}.
The fix in this case is to change the query to: The fix in this case is to change the query to:
...@@ -32178,8 +32220,13 @@ ON conditional_expr | ...@@ -32178,8 +32220,13 @@ ON conditional_expr |
USING (column_list) USING (column_list)
@end example @end example
Note that in versions before Version 3.23.16, the @code{INNER JOIN} didn't take You should never have any conditions in the @code{ON} part that are used to
a join condition! restrict which rows you have in the result set. If you want to restrict
which rows should be in the result, you have to do this in the @code{WHERE}
clause.
Note that in versions before Version 3.23.16, the @code{INNER JOIN} didn't
take a @code{join_condition}!
@cindex ODBC compatibility @cindex ODBC compatibility
@cindex compatibility, with ODBC @cindex compatibility, with ODBC
...@@ -32737,7 +32784,7 @@ files have become corrupted. ...@@ -32737,7 +32784,7 @@ files have become corrupted.
@example @example
REPLACE [LOW_PRIORITY | DELAYED] REPLACE [LOW_PRIORITY | DELAYED]
[INTO] tbl_name [(col_name,...)] [INTO] tbl_name [(col_name,...)]
VALUES (expression,...) VALUES (expression,...),(...),...
or REPLACE [LOW_PRIORITY | DELAYED] or REPLACE [LOW_PRIORITY | DELAYED]
[INTO] tbl_name [(col_name,...)] [INTO] tbl_name [(col_name,...)]
SELECT ... SELECT ...
...@@ -20,15 +20,15 @@ ...@@ -20,15 +20,15 @@
#ifndef _my_pthread_h #ifndef _my_pthread_h
#define _my_pthread_h #define _my_pthread_h
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h> #include <errno.h>
#ifndef ETIME #ifndef ETIME
#define ETIME ETIMEDOUT /* For FreeBSD */ #define ETIME ETIMEDOUT /* For FreeBSD */
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if defined(__WIN__) || defined(OS2) #if defined(__WIN__) || defined(OS2)
#ifdef OS2 #ifdef OS2
...@@ -617,7 +617,7 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const)); ...@@ -617,7 +617,7 @@ extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
#endif /* HAVE_ATOMIC_ADD */ #endif /* HAVE_ATOMIC_ADD */
#endif /* thread_safe_increment */ #endif /* thread_safe_increment */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment