mSQL
との比較この節は、MySQL 開発者によって書かれていますので、そのつもりで 読んで下さい。しかし我々が知っている事実上の間違いはありません。
For a list of all supported limits, functions and types, see the
crash-me
web page.
mSQL
should be quicker at:
INSERT
operations into very simple tables with few columns and keys.
CREATE TABLE
and DROP TABLE
.
SELECT
on something that isn't an index. (A table scan is very
easy.)
mSQL
や多くの他の SQL 実装よりとて
も速いです:
SELECT
operations.
VARCHAR
上にインデックスを持つことができます。
SELECT
with many expressions.
SELECT
on large tables.
mSQL
では、全ての他の接続は、最初のもの - クエリが長いか短いかに
関わらず - が実行され、終わるまで待つ必要があります。その後次の接続が与
えられ、他の全ては再び待ちます。
mSQL
can become pathologically slow if you change the order of tables
in a SELECT
. In the benchmark suite, a time more than 15000 times
slower than MySQL was seen. This is due to mSQL
's lack of a
join optimizer to order tables in the optimal order. However, if you put the
tables in exactly the right order in mSQL
2 and the WHERE
is
simple and uses index columns, the join will be relatively fast!
「10.8 Using your own benchmarks」節参照.
ORDER BY
and GROUP BY
.
DISTINCT
.
TEXT
または BLOB
フィールドの使用。
GROUP BY
and HAVING
.
mSQL
does not support GROUP BY
at all.
MySQL は HAVING
を伴う完全な GROUP BY
や、次の関
数 count()
, avg()
, min()
, max()
,
sum()
そして std()
をサポートします。min()
と
max()
は文字列の引数も取れます。count(*)
は、クエリ内がこ
れだけの場合にとても速く返されるように最適化されます。mSQL
は
GROUP BY
を全くサポートしません。
INSERT
and UPDATE
with calculations.
MySQL can do calculations in an INSERT
or UPDATE
.
For example:
mysql> UPDATE SET x=x*10+y WHERE x<20;
SELECT
with functions.
MySQL has many functions (too many to list here; see 「7.4 SELECT
と WHERE
節で使用する関数」節).
MEDIUMINT
です。10,000,000 レコードを持つ場合、1レコードあたり1バイトの節約でもと
ても重要です。
mSQL2
は4つの型(char,text,int,real)しかないので、小さなテーブルを
得るのは難しいです。
mSQL
安定性の経験がありません。そのため、我々はこれにつ
いては何も言えません。
mSQL
よりも柔軟なライセンスを持っています。そして mSQL
よ
りもより安いです。少なくとも、あなたが使用を選択した製品全てに、ライセン
スまたは email サポートへの支払いを考慮することを覚えていて下さい。
MySQL を含めた製品を売る場合、もちろんこのライセンスの獲得が要求
されます。
mSQL
と同じ perl インタフェースと、いくつかの追
加機能を持ちます。
mSQL
has a JDBC driver, but we have too little experience
with it to compare.
GROUP BY
などはまだ
mSQL
には実装されていませんので、it has a lot of chatching up to
do. この上でいくつかの見通しを得るために、去年の mSQL
`HISTORY' ファ
イルを見て、MySQL Reference Manual News 節と比較できます( 「D MySQL change history」節)。速く開発された多くのもの
が、かなり明白になります。
mSQL
と MySQL は多くの興味深いサードパーティツールを持っ
ています。上位への移行 (mSQL
-> MySQL) はとても簡単です。
MySQL は、ほとんど全ての興味深い mSQL
アプリケーションを
持っています。
MySQL には、簡単な msql2mysql
プログラムが用意されています。
これは、mSQL
と MySQL の C API 関数のスペルの違いを修正するプログラムです。
For example, it changes instances of msqlConnect()
to
mysql_connect()
.
mSQL
から MySQL への変換は通常、数分使用するだけです。
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:
msql2mysql
をソースに実行します。バイナリプログラム
replace
が必要です。これは MySQL で配布されます。
MySQL と mSQL
間の C API の違い:
MYSQL
構造体を接続型として使用します (mSQL
は
int
を使用します)。
mysql_connect()
は MYSQL
構造体へのポインタをパラメータとして使用します。そ
れをグローバルに定義したり、その獲得に malloc()
を使用するのは簡単です。
mysql_connect()
also takes 2 parameters for specifying the user and
password. You may set these to NULL, NULL
for default use.
mysql_error()
は MYSQL
構造体をパラメータとして使用します。古いコードを移
行する場合、あなたの古い msql_error()
コードへパラメータを追加してください。
mSQL
returns only a text error message.
mSQL
and MySQL client/server communications protocols differThere 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:
mSQL
2.0 間の SQL 構文の違いは?Column types
MySQL
CREATE TABLE
構文」節):
ENUM
type for one of a set of strings.
SET
type for many of a set of strings.
BIGINT
type for 64-bit integers.
UNSIGNED
オプション
ZEROFILL
オプション
PRIMARY KEY
も含み全ての整数項目への AUTO_INCREMENT
オプション
「20.4.29 mysql_insert_id()
」節参照.
DEFAULT
値
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
CREATE TABLE
statement.
mSQL
CREATE INDEX
statements.
To insert a unique identifier into a table
MySQL
AUTO_INCREMENT
as a column type
specifier.
「20.4.29 mysql_insert_id()
」節参照.
mSQL
SEQUENCE
on a table and select the _seq
column.
To obtain a unique identifier for a row
MySQL
PRIMARY KEY
or UNIQUE
key to the table.
mSQL
_rowid
column. Observe that _rowid
may change over time
depending on many factors.
To get the time a column was last modified
MySQL
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
_timestamp
column.
NULL
value comparisons
MySQL
NULL
is always NULL
.
mSQL
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
BINARY
attribute, which causes comparisons to be done according to the
ASCII order used on the MySQL server host.
mSQL
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
CLIKE
.
Handling of trailing spaces
MySQL
CHAR
and VARCHAR
columns. Use a TEXT
column if this behavior is not desired.
mSQL
WHERE
clauses
MySQL
AND
is evaluated
before OR
). To get mSQL
behavior in MySQL, use
parentheses (as shown below).
mSQL
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
mSQL
PostgreSQL
はさらに進んだ機能をいくつか持っています。ユーザ定義型、トリ
ガ、ルール、トランザクションのような。しかし ANSI SQL と ODBC の標準型と
機能の多くが欠けています。サポート/未サポートの型/関数の完全な一覧は
crash-me
web page を見てください。
通常、PostgreSQL
は MySQL よりとても遅いです。
「10.8 Using your own benchmarks」節参照. This is due largely to their
transactions system. If you really need transactions or 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.