Go to the first, previous, next, last section, table of contents.


23 How MySQL compares to other databases

23.1 MySQLmSQL との比較

この節は、MySQL 開発者によって書かれていますので、そのつもりで 読んで下さい。しかし我々が知っている事実上の間違いはありません。

For a list of all supported limits, functions and types, see the crash-me web page.

Performance
真の速度比較のためは、増加する MySQL ベンチマークスイートを見て下さい 「12.7 Using your own benchmarks」節参照. Because there is no thread creation overhead, a small parser, few features and simple security, mSQL should be quicker at: これらのオペレーションはとても単純なので、開始のオーバーヘッドが高くなる 時にそれらを良くするのは難しいです。接続が確立された後は MySQL はとても良い性能になります。 他のものでは MySQLmSQL や多くの他の SQL 実装よりとて も速いです:
SQL Features
領域能力
これは、テーブルをどのように小さくできるかです。 MySQL はとても精密な型を持ちます。とても小さい領域を使用するテーブルを作成でき るためです。MySQL データ型の有用な例は、3バイト長の MEDIUMINT です。10,000,000 レコードを持つ場合、1レコードあたり1バイトの節約でもと ても重要です。 mSQL2 は4つの型(char,text,int,real)しかないので、小さなテーブルを 得るのは難しいです。
安定性
これを客観的に判断するのは難しいです。MySQL の安定性については 「1.6 MySQL はどれくらい安定か?」節 を参照してください。 我々には mSQL 安定性の経験がありません。そのため、我々はこれにつ いては何も言えません。
価格
もう一つの重要な問題はもちろんライセンスです。MySQLmSQL よりも柔軟なライセンスを持っています。そして mSQL よ りもより安いです。少なくとも、あなたが使用を選択した製品全てに、ライセン スまたは email サポートへの支払いを考慮することを覚えていて下さい。 MySQL を含めた製品を売る場合、もちろんこのライセンスの獲得が要求 されます。
Perl interfaces
MySQL は基本的に mSQL と同じ perl インタフェースと、いくつかの追 加機能を持ちます。
JDBC (Java)
MySQL currently has 4 JDBC drivers: The recommended drivers are the twz or mm driver. Both are reported to work excellently. We know that mSQL has a JDBC driver, but we have too little experience with it to compare.
開発の速度
MySQL はとても小さい開発チームを持っていますが、我々は C と C++ のコーディ ングをとても速く行ないます。スレッド、関数、 GROUP BY などはまだ mSQL には実装されていませんので、it has a lot of chatching up to do. この上でいくつかの見通しを得るために、去年の mSQL `HISTORY' ファ イルを見て、MySQL Reference Manual News 節と比較できます( 「E MySQL change history」節)。速く開発された多くのもの が、かなり明白になります。
ユーティリティプログラム
mSQLMySQL は多くの興味深いサードパーティツールを持っ ています。上位への移行 (mSQL -> MySQL) はとても簡単です。 MySQL は、ほとんど全ての興味深い mSQL アプリケーションを 持っています。 MySQL には、簡単な msql2mysql プログラムが用意されています。 これは、mSQLMySQL の C API 関数のスペルの違いを修正するプログラムです。 For example, it changes instances of msqlConnect() to mysql_connect(). mSQL から MySQL への変換は通常、数分使用するだけです。

23.1.1 How to convert mSQL tools for MySQL

According to our experience, it would just take a few hours to convert tools such as msql-tcl and msqljava that use the mSQL C API so that they work with the MySQL C API.

The conversion procedure is:

  1. シェルスクリプト msql2mysql をソースに実行します。バイナリプログラム replace が必要です。これは MySQL で配布されます。
  2. Compile.
  3. 全てのコンパイラエラーを修復します.

MySQLmSQL 間の C API の違い:

23.1.2 How mSQL and MySQL client/server communications protocols differ

There are enough differences that it is impossible (or at least not easy) to support both.

The most significant ways in which the MySQL protocol differs from the mSQL protocol are listed below:

23.1.3 MySQL & mSQL 2.0 間の SQL 構文の違いは?

Column types

MySQL
他に加え次の項目オプション型を持ちます (among others; see 「7.7 CREATE TABLE構文」節):
MySQL also supports the following additional type attributes:
mSQL2
mSQL column types correspond to the MySQL types shown below:
mSQL type Corresponding MySQL type
CHAR(len) CHAR(len)
TEXT(len) TEXT(len). len is the maximal length. And LIKE works.
INT INT. With many more options!
REAL REAL. Or FLOAT. Both 4- and 8-byte versions are available.
UINT INT UNSIGNED
DATE DATE. Uses ANSI SQL format rather than mSQL's own.
TIME TIME
MONEY DECIMAL(12,2). A fixed-point value with two decimals.

Index creation

MySQL
Indexes may be specified at table creation time with the CREATE TABLE statement.
mSQL
Indexes must be created after the table has been created, with separate CREATE INDEX statements.

To insert a unique identifier into a table

MySQL
Use AUTO_INCREMENT as a column type specifier. 「22.4.29 mysql_insert_id()」節参照.
mSQL
Create a SEQUENCE on a table and select the _seq column.

To obtain a unique identifier for a row

MySQL
Add a PRIMARY KEY or UNIQUE key to the table and use this. New in 3.23.11: If the PRIMARY or UNIQUE key consists of only one column and this is of type integer, one can also refer to it as _rowid.
mSQL
Use the _rowid column. Observe that _rowid may change over time depending on many factors.

To get the time a column was last modified

MySQL
Add a TIMESTAMP column to the table. This column is automatically set to the current date and time for INSERT or UPDATE statements if you don't give the column a value or if you give it a NULL value.
mSQL
Use the _timestamp column.

NULL value comparisons

MySQL
MySQL follows ANSI SQL and a comparison with NULL is always NULL.
mSQL
In mSQL, NULL = NULL is TRUE. You must change =NULL to IS NULL and <>NULL to IS NOT NULL when porting old code from mSQL to MySQL.

String comparisons

MySQL
Normally, string comparisons are performed in case-independent fashion with the sort order determined by the current character set (ISO-8859-1 Latin1 by default). If you don't like this, declare your columns with the BINARY attribute, which causes comparisons to be done according to the ASCII order used on the MySQL server host.
mSQL
All string comparisons are performed in case-sensitive fashion with sorting in ASCII order.

Case-insensitive searching

MySQL
LIKE is a case-insensitive or case-sensitive operator, depending on the columns involved. If possible, MySQL uses indexes if the LIKE argument doesn't start with a wildcard character.
mSQL
Use CLIKE.

Handling of trailing spaces

MySQL
Strips all spaces at the end of CHAR and VARCHAR columns. Use a TEXT column if this behavior is not desired.
mSQL
Retains trailing space.

WHERE clauses

MySQL
MySQL correctly prioritizes everything (AND is evaluated before OR). To get mSQL behavior in MySQL, use parentheses (as shown below).
mSQL
Evaluates everything from left to right. This means that some logical calculations with more than three arguments cannot be expressed in any way. It also means you must change some queries when you upgrade to MySQL. You do this easily by adding parentheses. Suppose you have the following mSQL query:
mysql> SELECT * FROM table WHERE a=1 AND b=2 OR a=3 AND b=4;
To make MySQL evaluate this the way that mSQL would, you must add parentheses:
mysql> SELECT * FROM table WHERE (a=1 AND (b=2 OR (a=3 AND (b=4))));

Access control

MySQL
Has tables to store grant (permission) options per user, host and database. 「6.7 特権システムはどのように動くか?」節参照.
mSQL
Has a file `mSQL.acl' in which you can grant read/write privileges for users.

23.2 How MySQL compares to PostgreSQL

PostgreSQL はさらに進んだ機能をいくつか持っています。ユーザ定義型、トリ ガ、ルール、トランザクションのような。しかし ANSI SQL と ODBC の標準型と 機能の多くが欠けています。サポート/未サポートの型/関数の完全な一覧は crash-me web page を見てください。

通常、PostgreSQLMySQL よりとても遅いです。 「12.7 Using your own benchmarks」節参照. This is due largely to their transactions system which is not as sofisticated as Berkely DB's. In MySQL you can decide per table if you want the table to be fast or take the speed penalty of making it transaction safe. If you really the rich type system PostgreSQL offers and you can afford the speed penalty, you should take a look at PostgreSQL.


Go to the first, previous, next, last section, table of contents.