これは MySQL のリファレンスマニュアルです; これは MySQL バージョン 3.23.47 について記述しています。
MySQL は発展中なので、マニュアルは頻繁に更新されます。そのため、 オンラインで参照しない限り、このバージョンが期限切れである可能性があります。 このマニュアルの最新バージョンは http://www.mysql.com/documentation/ に多 様な形式で置いてあります。マニュアル内の情報を見つけるつらい時間を持つなら、 検索可能 PHP バージョン http://www.mysql.com/documentation/manual.php を試す ことが可能です。
MySQL はとても高速で、マルチスレッド、マルチユーザの、頑丈な SQL (Structured Query Language)データベースサーバです。
MySQL はフリーソフトウェアです。GNU GENERAL PUBLIC LICENSE http://www.gnu.org/ でライセンスされています。 「1.3 MySQL ライセンスとサポート」節参照.
MySQL ホームページは MySQL についての最新情報を提供しています。
次のリストはマニュアルのいくつかの有用なセクションを説明しています:
重要:
エラー(バグ)レポート、質問、コメントは
メーリングリスト mysql@lists.mysql.com に送ってください。 「1.2.22.3 バグや問題を報告する方法」節参照。
バグレポートを生成するためには mysqlbug
スクリプトを使用すべきです。
ソースディストリビューションでは、mysqlbug
スクリプトは `scripts' ディレクトリ
に見つけることができます。バイナリディストリビューションでは、mysqlbug
は
`bin' ディレクトリに見つけることができます。
MySQL のセキュリティバグを発見した場合は、
security@mysql.com に email を送ってください。
このマニュアルへの追加または修正に関連する提案がある場合は、それらを MySQL マニュアルチーム docs@mysql.com に 送ってください。
これはリファレンスマニュアルです。一般的な SQL やリレーショナルデータベー ス概念の説明書ではありません。SQL についての一般的な情報を得たければ、 「1.2.2 一般的な SQL 情報とチュートリアル」節 を見てください。特に MySQL に焦点をあてた本につ いては、 「1.2.1 MySQL 関連の書籍」節 を見てください。
MySQLは、もっとも有名なオープンソースSQLデータベースで、 MySQL AB によって供給されています。MySQL AB は MySQL データベースのまわりのサービスを提供するビジネスを構築する 営利会社です。 「1.1.2 What Is MySQL AB」節参照.
MySQL の公式な発音は ``My Ess Que Ell'' です(MY-SEQUEL ではあり ません)。 しかし MY-SEQUEL と発音する人を正すことは避けています。
MySQL AB は、MySQL の創始者と主な開発者によって所有され、 運営されているスウェーデンの会社です。我々は、MySQL の開発と我々 のデータベースを新しいユーザに広げることに専念しています。MySQL AB は MySQL サーバソースコードの著作権と MySQL 商標を所 有します。我々のサービスからの重要な収益の総量は MySQL の開発に向 けられます。 「1.1.1 What Is MySQL」節参照.
MySQL AB has been profitable providing MySQL from the start. We don't get any outside funding, but have earned all our money ourselves.
私たちはMySQLの開発ペースをより良いものにするために、開発に協力して下さるパートナーを求めています。 もしあなたがこの仕事に興味を持って下さるなら、partner@mysql.comまで御連絡下さい。
現在MySQL AB には20人以上のスタッフ (http://www.mysql.com/development/team.html)を有しており、採用と成長のペースは急速なものです。
MySQL AB has currently 20+ people (http://www.mysql.com/development/team.html) on its payroll and is growing rapidly.
Our main sources of income are:
The MySQL core values show our dedication to MySQL and Open Source.
我々は MySQL を次のようにしたいです。
MySQL AB と MySQL AB の人々は次を行ないます。
このマニュアルは以下の方々により訳されました (ハンドル名だけ書きます。敬称略。翻訳サーバーに登録した順 :) ):
このマニュアルは現在 Texinfo, プレーンテキスト, Info, HTML,
PostScript, PDF バージョンがあります。
プライマリドキュメントは Texinfo ファイルです。HTML バージョンは
texi2html
の変更されたバージョンで自動的に提供されます。プレーン
テキストと Info バージョンは makeinfo
で提供されます。PostScript
バージョンは texi2dvi
と divps
を使用して提供されます。PDF
バージョンは pdftex
で提供されます。
このマニュアルは David Axmark, Michael (Monty) Widenius, Jeremy Cole, Paul DuBois, によって作成され、維持されています。他の貢献者については 「E Credits」節 を参照してください。
このマニュアルは特定の印刷上の表記を使用しています:
constant
mysqladmin
がどのように動作するかを見るためには、
--help
オプションをつけて起動してください。''
コマンドが特定のプログラムによって実行されることを意味することを表す時、
コマンドと共に表示されるプロンプトによって、そのプログラムを表します。例えば、
shell>
は、あなたのログインシェルから実行するコマンドを表し、
mysql>
は mysql
クライアントプログラムから実行するコマンドを表します:
shell> type a shell command here mysql> type a mysql command here
シェルコマンドは Bourne シェル構文で示されます。csh
形式のシェ
ルを使用している場合は、わずかに変更してコマンドを発行する必要があるでしょ
う。例えば、環境変数を設定してコマンドを実行するシーケンスは、Bourne シェ
ル構文では次のようになります:
shell> VARNAME=value some_command
csh
では、次のようなシーケンスを実行してください:
shell> setenv VARNAME value shell> some_command
データベース名, テーブル名, フィールド名はコマンドの中で置換しなければいけない
ことがよくあります。このような置換が必要なことを示すために、このマニュア
ルは db_name
, tbl_name
, col_name
を使用します。
例えば、次のようなステートメントを見た場合:
mysql> SELECT col_name FROM db_name.tbl_name;
これは、同様のステートメントを入力するためには、おそらく次のように、あな た自身のデータベース名, テーブル名, フィールド名を供給することを意味します:
mysql> SELECT author_name FROM biblio_db.author_list;
SQL ステートメントは大文字でも小文字でも記述できます。このマニュアルが
SQL ステートメントを示すときは、特別なキーワードを説明している時には(そ
れを強調するために)そのキーワードに大文字が使用され、残りのステートメン
トに小文字が使用されます。 例えば、SELECT
ステートメントの説明中
には次が見られるでしょう:
mysql> SELECT count(*) FROM tbl_name;
一方、COUNT()
関数の説明中では、ステートメントは次のように書かれ
ます:
mysql> select COUNT(*) from tbl_name;
特別な強調が意図されない場合、全てのキーワードは大文字で書かれます。
構文の説明中では、角括弧(`[' と `]')はオプションの単語や節であ ることを示すために使用されます:
DROP TABLE [IF EXISTS] tbl_name
構文要素がいくつかのものからなる場合、垂直バー(`|')で区切られます。 選択セットから一つのメンバを選ぶことができるときは、角括弧中にリストされ ます。(`[' and `]'):
TRIM([[BOTH | LEADING | TRAILING] [remstr] FROM] str)
選択セットから一つのメンバを選ぶ必要があるときは、波括弧(`{' と `}')中にリストされます:
{DESCRIBE | DESC} tbl_name {col_name | wild}
最初は、我々固有の速くて低レベルな (ISAM) ルーチンを使用したテーブルへ
接続するために、 mSQL
を使用するつもりでした。
しかし、いくつかのテストの後、我々は
mSQL
は我々が必要とするほど高速ではなく、柔軟度を持っていないとの
結論に至りました。この結果、mSQL
とほとんど同じ API インタフェー
スを持つ、我々のデータベースへの新しい SQL インタフェースに帰結しました。
この API はサードパーティコードの移植を簡単にするために選択されました。
MySQL の名前の由来は完全には明らかではありません。我々のベース ディレクトリと多くのライブラリとツールは接頭辞 ``my'' を 10 年以上も使っ ています。しかし、Monty の娘(何年か若い)も My という名前です。そのため、 この2つのどちらが MySQL に名前を与えたかは、我々にとっても未だ 謎です。
MySQL の重要な特徴のいくつかを以下の項目にあげます:
FLOAT
, DOUBLE
, CHAR
, VARCHAR
,
TEXT
, BLOB
, DATE
, TIME
, DATETIME
,
TIMESTAMP
, YEAR
, SET
, ENUM
型.
「6.2 フィールド型」節参照.
SELECT
と WHERE
部内での全ての演算子と関数のサポー
ト。例:
mysql> SELECT CONCAT(first_name, " ", last_name) FROM tbl_name WHERE income/dependents > 10000 AND age > 30;
GROUP BY
と ORDER BY
節の完全なサポート。グループ関数
(COUNT()
, COUNT(DISTINCT ...)
,
AVG()
, STD()
, SUM()
, MAX()
and MIN()
) のサポート。
LEFT OUTER JOIN
, RIGHT OUTER JOIN
のサポート。
CHAR
または VARCHAR
フィールドの先頭部分を使用できます。
MySQL
を使用しているユーザを知っています。
INSERT
を使用でき、明示的に値が与えられていないフィールドはそのデ
フォルト値が設定されます。
myisamchk
を含んでいます。これは、テーブル検査、最適化、修復のため
のとても速いユーティリティです。
All of the functionality of myisamchk
is also available through the SQL interface as well.
「4 MySQL Database Administration」節参照.
DELETE
, INSERT
, REPLACE
, UPDATE
は
変更された(影響を受けた)行の数を返します。
サーバ接続時にフラグを設定することにより、代わりに適合したレコード数を返す
ことも可能です。
ABS
は正しいフィールド
名です。制限は、関数呼び出しに、関数名とそれに続く `(' の間に空白が
許されないことだけです。 「6.1.6 Is MySQL Picky About Reserved Words?」節参照。
--help
と -?
オプションで呼び出すことができます。
SHOW
コマンドはデータベース、テーブル、イン
デックスについての情報を取出すために使用できます。EXPLAIN
コマン
ドはオプティマイザがどのようにクエリを解析するかを決定するために使用
できます。
この節では、``MySQL はどれくらい安定か?'' と ``私はこのプロジェ クトの MySQL に依存できるか?'' という質問について回答します。
我々はここで、いくつかの問題を明らかにし、多くの人に関係すると思われるさ らに重要な質問のいくつかを回答することを試みます。この節は、メーリングリ スト(そこではとても活発にバグが報告されています)から取り込まれた情報が一 緒に置かれています。
TcX では、MySQL は 1996 中頃から我々のプロジェクトで何の問題も なく動いていました。広く公にリリースされた時、我々は、MySQL 内 に ``テストされていないコード'' の部分があることに注意しました。これは、 我々とは異なる方法でクエリを作成する新しいユーザによってすぐに見つけられました。 新しい各リリースは、(多くの新しい機能を持っているのに)前のものよりも問題 は少なくなります。そして次のリリースの一つを ``安定'' と呼ぶことができるよ うに我々は望んでいます。
MySQL の各リリースは実用的で、ユーザが ``グレイゾーン'' からの コードの使用を開始する時にだけ問題があります。当然、外部のユーザは、何が グレイゾーンかを知ることができません; この節で現在知られているこれらを示 してみます。 説明は MySQL の 3.23.x バージョンで扱われます。知られていて報告 されているバグは全て最新のバージョンで修正されています。bugs 節に 書かれているバグは除きます。それらは ``設計'' 関連のものです。 「1.4.7 MySQL での既知のエラーと欠けているデザイン」節参照.
MySQL は複数の階層と様々な独立モジュールで書かれています。これ らのモジュールは、それぞれがどのようにテストされているかとともに次にリス トされています:
mysql
, mysqladmin
, mysqlshow
,
mysqldump
, mysqlimport
を含みます.
--skip-locking
フラグつきで動かすべ
きです。知られている問題は、いくつかの Linux システムと NFS マウントされ
たファイルシステム使用時の SunOS です。
fcntl()
コールでだけ問題が見つかっています。これは mysqld
への --skip-locking
オプションの使用で修正できます。何人かは
バージョン 0.5 リリースで lockup 問題を報告しました。1000以上の同時接続を使用する予
定であれば、LinuxThreads を再コンパイルする必要があります。しかし、デフォ
ルトの LinuxThread でも多くの接続を実行することは可能です(しかし 1021 以
上にならないようにしてください)。デフォルトの 2MB のスタック空間は、アプ
リケーションを不安定にします。そして 1021 個のアイドル接続の生成後に
coredump を引き起こします。詳しくは 「2.6.1 Linux Notes (All Linux Versions)」節参照. をご覧ください。
SELECT
では、ステートメントは通常一度のフレームで行われるため、
mutex locking/thread juggling はありません。
LOAD DATA...
, INSERT ... SELECT
-- 安定
ALTER TABLE
-- 安定
mysqlaccess
-- 安定
GRANT
-- 安定
MySQL
. They appear to work good and
can be used after some initial testing.
MERGE
テーブル上でのキーの使用は、まだテストされていません。
MERGE
コードのほかの部分は完全にテストされています。
MySQL AB は代金を支払った顧客のために email サポートを提供しています。しかし MySQL メーリングリストは通常、全ての一般的な質問に回答を提供し ています。バグは通常すぐにパッチで修正され、深刻なバグには、ほとんどいつ も新しいリリースがあります。
MySQL Version 3.22では、最大テーブルサイズに 4Gbyte という制限がありました。
MySQL Version 3.23から採用された新しい MyISAM
では、
最大テーブルサイズは800万テラバイト( 2 ^ 63 bytes )に拡張されました。
ただし、OSの側にも、ファイルサイズの制限が存在していることには注意して下さい。 いくつか例を示します:
Operating System | File Size Limit |
Linux-Intel 32 bit | 2G, 4G あるいはそれ以上, Linux のバージョンによる。 |
Linux-Alpha | 8T (?) |
Solaris 2.5.1 | 2G (パッチにより 4G に対応) |
Solaris 2.6 | 4G |
Solaris 2.7 Intel | 4G |
Solaris 2.7 ULTRA-SPARC | 8T (?) |
Linux 2.2 では、ext2ファイルシステム用のLFSパッチを適用することで、 2G 以上のテーブルを使用することができます。 Linux 2.4ではReiserFS用の同様のパッチが存在し、大きなファイルを扱うことができるようになります。 (訳注: Linux 2.4.1 以上では、最初から ReiserFS がカーネルのソースに組み込まれています)
以上からわかるように、MySQLの最大テーブルサイズはOSの制限によって決まることがほとんどです。
デフォルトでは、MySQLの最大テーブルサイズは4Gに設定されています。
あるテーブルの最大テーブルサイズは、SHOW TABLE STATUS
コマンドか、
myisamchk -dv table_name
によって確認することができます。 「4.5.5 SHOW
構文」節参照.
もしも4G 以上のテーブルが必要な場合には(加えて、OSがそれをサポートしている場合には)、
テーブルを作る際に、AVG_ROW_LENGTH
と MAX_ROWS
パラメータを設定することができます。
「6.5.3 CREATE TABLE
構文」節参照.
テーブル作成後に、ALTER TABLE
で変更することもできます。 「6.5.4 ALTER TABLE
構文」節参照
読み込み専用の大きなテーブルが必要な時は、
myisampack
を使って複数のテーブルを一つにまとめた上で圧縮することができます。
myisampack
は、テーブルの大きさをだいたい50%程度まで圧縮できます。
結果として、より大きなテーブルを作ることが可能となるでしょう。 「4.7.4 myisampack, MySQL の圧縮された読み込み専用テーブルジェネレータ」節参照.
MyISAM
データファイルに対する、OSのファイル制限を回避するのに、
RAID
オプションを使うこともできます。 「6.5.3 CREATE TABLE
構文」節参照.
MERGEライブラリ -- 同じ構造のテーブルをひとまとめに扱う機能を提供します -- を 使用するという解決法も考えられるでしょう。 「7.2 MERGE Tables」節参照.
MySQL 自身は 2000 年問題(Y2K)に対して何の問題も持っていません:
2069
年まで日付には何の
問題もありません; 全ての2桁の年は 1970
から 2069
の範囲に
あると見なされます。これは、year
フィールド内に 01
を格納する場
合、MySQL はそれを 2001
として扱うということを意味します。
YEAR
フィールド型は
0
と 1901
から 2155
までの年を1バイトで格納でき、2
桁または4桁で表示できます。
2000年安全でない方法で MySQL を使用するアプリケーションでは問題
になります。例えば、多くの古いアプリケーションは4桁値ではなく2桁値(これ
は曖昧です)を使用して年を格納し操作します。この問題は、00
または
99
のような値を ``欠けている'' 値の表われとして使用するアプリケー
ションによって作られます。
あいにく、これらの問題を修正するのは困難です。様々なアプリケーションが様々 なプログラムによって書かれていて、その各々が慣習と日付操作関数の様々な組 み合わせを使用するからです。
これは、MySQL が 2030 年までの日付に何の問題もないことを示す簡単なテスト です:
mysql> DROP TABLE IF EXISTS y2k; Query OK, 0 rows affected (0.01 sec) mysql> CREATE TABLE y2k (date date, date_time datetime, time_stamp timestamp); Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO y2k VALUES -> ("1998-12-31","1998-12-31 23:59:59",19981231235959), -> ("1999-01-01","1999-01-01 00:00:00",19990101000000), -> ("1999-09-09","1999-09-09 23:59:59",19990909235959), -> ("2000-01-01","2000-01-01 00:00:00",20000101000000), -> ("2000-02-28","2000-02-28 00:00:00",20000228000000), -> ("2000-02-29","2000-02-29 00:00:00",20000229000000), -> ("2000-03-01","2000-03-01 00:00:00",20000301000000), -> ("2000-12-31","2000-12-31 23:59:59",20001231235959), -> ("2001-01-01","2001-01-01 00:00:00",20010101000000), -> ("2004-12-31","2004-12-31 23:59:59",20041231235959), -> ("2005-01-01","2005-01-01 00:00:00",20050101000000), -> ("2030-01-01","2030-01-01 00:00:00",20300101000000), -> ("2050-01-01","2050-01-01 00:00:00",20500101000000); Query OK, 13 rows affected (0.01 sec) Records: 13 Duplicates: 0 Warnings: 0 mysql> SELECT * FROM y2k; +------------+---------------------+----------------+ | date | date_time | time_stamp | +------------+---------------------+----------------+ | 1998-12-31 | 1998-12-31 23:59:59 | 19981231235959 | | 1999-01-01 | 1999-01-01 00:00:00 | 19990101000000 | | 1999-09-09 | 1999-09-09 23:59:59 | 19990909235959 | | 2000-01-01 | 2000-01-01 00:00:00 | 20000101000000 | | 2000-02-28 | 2000-02-28 00:00:00 | 20000228000000 | | 2000-02-29 | 2000-02-29 00:00:00 | 20000229000000 | | 2000-03-01 | 2000-03-01 00:00:00 | 20000301000000 | | 2000-12-31 | 2000-12-31 23:59:59 | 20001231235959 | | 2001-01-01 | 2001-01-01 00:00:00 | 20010101000000 | | 2004-12-31 | 2004-12-31 23:59:59 | 20041231235959 | | 2005-01-01 | 2005-01-01 00:00:00 | 20050101000000 | | 2030-01-01 | 2030-01-01 00:00:00 | 20300101000000 | | 2050-01-01 | 2050-01-01 00:00:00 | 00000000000000 | +------------+---------------------+----------------+ 13 rows in set (0.00 sec)
これは、DATE
と DATETIME
型は未来のいかなる日付において
問題のないことををしめします (これら日付は 9999 年まで扱えます)
TIMESTAMP
型は、時刻を保存しますが、2030-01-01
までです。
TIMESTAMP
は 32-bit マシンで(signed value)は 1970
から 2030
の範囲です。
64-bit マシンでは、 2106
年(unsigned value)まで扱えれます。
MySQL は 2000年対応ですが、曖昧でない入力を提供するのはあなたの 責任です。曖昧な日付の入力データ(2桁の年の値)の扱いについての MySQL の規則については 「6.2.2.1 西暦2000年問題とデータ型」節 を参照してください。
For the latest book information, with user comments, please visit http://www.mysql.com/portal/books/html/index.html.
このマニュアルからも最新の技術情報を得ることができますが、 その主目的は、 MySQLについての全てを網羅することです。 時には旅行中やベッドの上でも 気軽に読めるようなMySQL関連の本が欲しいということはないでしょうか。 以下にMySQL及び関連項目についての書籍の一覧を挙げておきます。 (英語)
表中のリンク先のサイトから書籍をご購入いただきますと、 その売上は MySQLの開発に役立てられます。
MySQL
入手先 | Barnes and Noble |
出版元 | New Riders |
著者名 | Paul DuBois |
発行日 | 初版 1999年12月 |
ISBN | 0735709211 |
ページ数 | 800 |
価格 | $49.99 US |
ダウンロード可能なサンプル |
samp_db distribution
|
正誤表 | ここにあります |
はしがきはMySQLのモデレータ、 Michael ``Monty'' Widenius氏によって執
筆されました。
MySQLは最も人気のあるリレーショナルデータベースの一つ、MySQLについての
完全ガイドブックです。 著者のPaul DuBois氏はMySQLのオンラインドキュ
メントの執筆にも貢献しており、 MySQLのコミュニティにおいて積極的に活
動を続けています。 原稿はMySQLの主要開発メンバーであるMonty Widenius
氏と彼のチームメンバーによって閲覧、評価され、 無比の識見をDuBois氏に与えまし
た。
本書は単にMySQLについての一般的な概要を述べたものではなく、
MySQLの力を最大限に利用する方法が紹介されています。 2つのサンプルア
プリケーションを通して、 MySQLユーザが必ず直面する問題への解決策が述べられて
います。 本書はMySQLをPHPやPerlと言った、 サードパーティーの技術と効
率的に組み合わせて、 クエリを用いた動的なウェブページを構築する一助にもなりま
す。 MySQLデータベースにアクセスするためのプログラムの書き方、 項目の
データ形式、 演算子、 関数、 SQL構文、 MySQLプログラミング、 C言語API、
Perl DBI
API、 PHP APIについての包括的なリファレンスが載っています。
MySQLには他の本には載っていないような情報が多く掲載されています。
本書の特徴は以下のとおりです。
DBI
と
PHP APIを使うためのガイド
DBI
API、 PHP API関連の関数についての完全リファレンス
MySQL & mSQL
入手先 | Barnes and Noble |
出版元 | O'Reilly |
著者名 | Randy Jay Yarger, George Reese & Tim King |
発行日 | 初版 1999年7月 |
ISBN | 1-56592-434-7, 注文番号: 4347 |
ページ数 | 506 |
価格 | $34.95 |
本書ではLinux, UNIXシステムの両方において主要なSQLをサポートする、 堅牢性に優
れた人気の2大データベース、 MySQLとmSQL
の使い方について解説し
ています。 基本的なC、Java,Perl, Pythonを知っている方なら、スタンドアロン型で
あれウェブページ用であれ誰でもデータ-ベースとやり取りするためのプログラムを
書くことができます。 本書ではインストールからプログラミング・インターフェース
の設定、 基本的な管理の仕方までの全ての過程を網羅しております。 チュートリアル
も豊富です。
Sams' Teach Yourself MySQL in 21 Days
入手先 | Barnes and Noble |
出版元 | Sams |
著者名 | Mark Maslakowski and Tony Butcher |
発行日 | 2000年6月 |
ISBN | 0672319144 |
ページ数 | 650 |
価格 | $39.99 |
Sams' Teach Yourself MySQL in 21 Daysは、 データ-ベースをはじめたい中 級Linuxユーザ向けの書籍です。 この本の読者の中で多数を占めるのは、インター ネットから得られる大量の情報を保管できるデータベースを必要とするWeb開発者で す。
Sams' Teach Yourself MySQL in 21 Daysはステップごとに解説した、 実用的
なチュートリアル本です。 実用的な、 現場に即した実例を使って、 オープンソースの
データベースであるMySQLをウェブページ向けにデザイン、活用できるよう
になります。
E-Commerce Solutions with MySQL
入手先 | Barnes and Noble |
出版元 | Prima Communications, Inc. |
著者名 | 該当なし |
発行日 | 2000年1月 |
ISBN | 0761524452 |
ページ数 | 500 |
価格 | $39.99 |
解説なし
MySQL and PHP from Scratch
入手先 | Barnes and Noble |
出版元 | Que |
著者名 | 解説なし |
発行日 | 2000年9月 |
ISBN | 0789724405 |
ページ数 | 550 |
価格 | $34.99 |
本書はApacheのインストール、 セットアップ、 トラブルシューティング、
MySQL、 PHP3、 IMPについての情報を全て1冊の本にまとめたものです。 Web
ベースのEメールシステムを作り上げる方法をステップ毎に学習することによって、
個々の技術が全体の中でどんな役割を果たしているのかを学ぶこともできます。 PHP3
を使って、 Active Server Pages (ASP)と同等のことができるということや、 データ-
ベースとApacheサーバーを使ったe-commerceサイトの立ち上げ、 パソコンへのインス
トールを必要としないデータ入力システム(売上、 商品の品質管理、 顧客情報等)の作
成についても学習します。
Professional MySQL Programming
入手先 | Barnes and Noble |
出版元 | Wrox Press, Inc. |
著者名 | 該当なし |
発行日 | 2001年後半期 |
ISBN | 1861005164 |
ページ数 | 1000 |
価格 | $49.99 |
解説なし
Professional Linux Programming
入手先 | Barnes and Noble |
出版元 | Wrox Press, Inc. |
著者名 | 該当なし |
発行日 | 2000年9月 |
ISBN | 1861003013 |
ページ数 | 1155 |
価格 | $47.99 |
ベストセラー、 Beginning Linux Programmingの続編である本書では、 著者の
実際の開発場面における知識やLinuxプラットフォームでの開発経験から学ぶことが
できます。 'DVD Store'というサンプルアプリケーションを開発するという筋立てに
なっており、 'theme'の章ではアプリケーションのコーディングにおける異なった見
方が述べられています。 また、 'take-a-break'という項目では、 主題の範囲を越えた
重要なトピックについてカバーしております。 本書では仕事にあった正しいツールを
選び、 使うべきときにそのツールを使い、 初めて使った時点で成功させることについ
ての重要性が示されており、 一冊全てにおいてプログラミングの実用的な側面につい
て焦点が置かれています。
PHP and MySQL Web Development
入手先 | Barnes and Noble |
出版元 | Sams |
著者名 | Luke Welling, Laura Thomson |
発行日 | 2001年3月 |
ISBN | 0672317842 |
ページ数 | 700 |
価格 | $49.99 |
PHP and MySQL Web Developmentでは、 MySQLとPHPの両方を使うこ
との利点について紹介されています。 これらの利点については統計、 事例研究の両面
からさらに細かく解説されています。 機能的なオンラインデータベースプログラミン
グに必要なツールを紹介しながら、 一冊を通して実用的なWebアプリケーションを開
発していきます。 好きな部分だけコーディング・使用できるように、 各関数は別々に
実装・解説されています。 MySQLサポートをPHPスクリプトに組み入れるた
めの関数や、 テーブル操作についての上級者向けトピックを含めた、 PHPプログラミ
ングのコンセプトについても強調されています。
Books recommended by the MySQL Developers
SQL-99 Complete, Really
入手先 | Barnes and Noble |
出版元 | CMP Books |
著者名 | Peter Gulutzan, Trudy Pelzer |
発行日 | 1999年4月 |
ISBN | 0879305681 |
ページ数 | 1104 |
価格 | $55.96 |
本書ではSQLデータベースにおける文法、 データ構造、 データ取得プロセスの新基準
についての完全な説明がなされています。 CLIの全ての関数、 情報、 スキーマ・テー
ブル、 ステータスコードが載っており、 実例中心のリファレンス本としても役立ちま
す。 付属のディスクには実際に動かせるSQLデータベースも収録されています。
C, A reference manual
入手先 | Barnes and Noble |
出版元 | Prentice Hall |
著者名 | Samuel P. Harbison, Guy L. Steele |
発行日 | 1994年9月 |
ISBN | 0133262243 |
ページ数 | 480 |
価格 | $35.99 |
C言語リファレンスのベストセラーが改訂、 新版となりました。 本書は「クリーンな
C」の概念、 C++プログラムとしてコンパイルできるCコードの書き方、 正確さ、 移植
性、 保守性に重点を置いたCプログラミングスタイルを紹介しております。 また、 移
植性が高く国際化対応したCプログラムを書くための新規格を定めたISO Amendment
1(1994年)も取り入れられています。
C++ for Real Programmers
入手先 | Barnes and Noble |
出版元 | Academic Press, Incorporated |
著者名 | Jeff Alger, Jim Keogh |
発行日 | 1998年2月 |
ISBN | 0120499428 |
ページ数 | 388 |
価格 | $39.95 |
C++ For Real Programmersは入門本に解説されているような初級、中級者向け のC++とエキスパートが実際に使っているC++のギャップの橋渡しとして書かれた本で す。 数々の一読に値するテクニックが 間接参照、 クラス階層、 メモリ管理の3章にわ たって紹介されています。 テンプレートの作成、 例外処理、 ポインタ、 最適化テク ニックについても詳細に扱っております。 本書はANSI C++に焦点を置いており、 特定 のコンパイラに依存しません。
C++ For Real Programmers は Secrets of the C++ Mastersの改訂版
であり、 C++とJavaを比較した、 新しい付録が加わりました。 ソースコードを収録し
たWindows用の3.5インチフロッピーディスクが付属でついています。
Algorithms in C
入手先 | Barnes and Noble |
出版元 | Addison Wesley Longman, Inc. |
著者名 | Robert Sedgewick |
発行日 | 1990年4月 |
ISBN | 0201514257 |
ページ数 | 648 |
価格 | $45.75 |
Algorithms in Cでは並べ替え、 検索、 文字列処理や、 幾何学、 グラフ、 数学
関連のアルゴリズム等、 数々の興味分野における様々なアルゴリズムについて解説さ
れています。 本書では根本的なテクニックについて重点を置き、 役立つアルゴリズム
を自信もってコーディング、実行、 デバッグする手段を紹介します。
Multithreaded Programming with Pthreads
入手先 | Barnes and Noble |
出版元 | Prentice Hall |
著者名 | Bil Lewis, Daniel J. Berg |
発行日 | 1997年10月 |
ISBN | 0136807291 |
ページ数 | 432 |
価格 | $34.95 |
Based on the best-selling ベストセラー、 Threads Primerを元にして執筆
されたMultithreaded Programming with Pthreadsは、 Posixスレッドについ
ての理解を確実にすることが目的です。 Posixスレッドとは何か、 スレッドの仕組み、
どのようなときに使うべきか、 最適化の方法について述べられています。
Threads Primerの分かりやすくユーモアのある文章はそのままですが、 Win32
とOS/2プラットフォームにおけるスレッドの実行については前作よりさらに幅広く比
較されています。 主要な全てのUNIXプラットフォームでテスト済みのサンプルコード
は、 スレッドを使用した理由、 どうやってスレッドを使用したのかについての詳細な
説明つきです。
Programming the PERL DBI: Database Programming with PERL
入手先 | Barnes and Noble |
出版元 | O'Reilly & Associates, Incorporated |
著者名 | Alligator Descartes, Tim Bunce |
発行日 | 2000年2月 |
ISBN | 1565926994 |
ページ数 | 400 |
価格 | $27.96 |
Programming the Perl DBIではDBIコミュニティで最も積極的な活動メンバー の一人、 Alligator Descartesや、 DBIの考案者であるTim Bunceが共著しています。 初学者向けには、 DBIの構造やDBIベースのプログラムの書き方について解説してあり ます。 上級者向けには、 DBIのニュアンスや個々のDBDの特色について解説されていま す。
本書の特徴として、次のようなものがあります。
この本は MySQL メーリングリストの数人によって推奨されています:
Judith S. Bowman, Sandra L. Emerson and Marcy Darnovsky The Practical SQL Handbook: Using Structured Query Language Second Edition Addison-Wesley ISBN 0-201-62623-3 http://www.awl.com
この本も MySQL ユーザーにいくつかの推薦を受けています:
Martin Gruber Understanding SQL ISBN 0-89588-644-8 Publisher Sybex 510 523 8233 Alameda, CA USA
SQL チュートリアルがネット上にあります http://w3.one.net/~jhoffman/sqltut.htm
次のリンク以外にも、多くの MySQL プログラム、ツール、API を Contrib directory から見つけてダウ ンロードすることができます。
1.2.4 Tutorials and Manuals
mSQL
.
mSQL
Tcl.
DBI
/DBD
.
DBI
/DBD
modules homepage.
MySQL を使用した多くの web ページもあります。 「B Some MySQL Users」節参照。この リストへ追加できるものを webmaster@mysql.com に送ってください。 あなたのサイトを追加してほしいとあなたが望む場合、我々は MySQL の ロゴをどこかに示すことを要求しています。(``使用ツール'' ページや似たような どこか上で構いません。)
この章は MySQL メーリングリストを紹介し、それをどのように使用する かのガイドラインを提供します。
メイン MySQL メーリングリストを購読するには、メッセージを 電子メールアドレス mysql-subscribe@lists.mysql.com に送ってください。
メイン MySQL メーリングリストの購読の中止は、メッセージを 電子メールアドレス mysql-unsubscribe@lists.mysql.com に送ってください。
メッセージを送る先のアドレスだけが重要です。メッセージのサブジェクトと 本文は無視されます。
もし、あなたのリプライアドレスが妥当な物でない場合、アドレスを明確に指定することが出来ます。
subscribe あるいは unsubscribe のあとにハイフンを付け、そのあとにあなたの
アドレスを記述します。ただし `@' 文字は `=' に置き変えて書きます。
例えば、 your_name@host.domain
で購読したい場合、
mysql-subscribe-your_name=host.domain@lists.mysql.com
宛にメッセージを送ります。
mysql-subscribe@lists.mysql.com や mysql-unsubscribe@lists.mysql.com へのメールは ezmlm メーリングリストプロセッサによって自動的に処理されます。 ezmlm についての情報は The ezmlm Website.
本メーリングリストへの投稿を行うには、mysql@lists.mysql.com
にメッセージを送ります。
しかし、subscribe あるいは unsubscribe のメールを
mysql@lists.mysql.com に送らないでください。
これらのアドレスへ送られたメールは、何千ものユーザーに配送されてしまいます。
あなたのローカルサイトが多くの mysql@lists.mysql.com 購読者を持つことも
あります。この場合、ローカルメーリングリストを作り、lists.mysql.com
からの
一つのメッセージがそのサイトに送られ、ローカルなリストで複写されるように
してください。この場合、ローカルの MySQL リストへの追加と削除は、
あなたのシステム管理者に問い合わせて下さい。
あなたのメーラーでMySQL メーリングリストからのメールを
適切なメールボックスへ振り分けるには、
(振り分け用の)フィルタをメッセージヘッダを頼りに動作するよう設定して下さい。
その場合、List-ID:
ヘッダか Delivered-To:
ヘッダが
識別の役に立つことでしょう。
次の MySQL メーリングリストがあります:
announce-subscribe@lists.mysql.com announce
mysql-subscribe@lists.mysql.com mysql
mysql-digest-subscribe@lists.mysql.com mysql-digest
mysql
リストです。これは、一日に一回、一つの大
きなメールが送られることで個々のメッセージ全てが得られることを意味します。
bugs-subscribe@lists.mysql.com bugs
mysqlbug
を使
用して投稿すべきです(Windows 上で実行している場合は、OS と
MySQL バージョンの記述を含めるべきです)。できれば、投稿前に
MySQL の最新の安定バージョンか開発バージョンを使用して問題をテ
ストすべきです! 含められたテストケース上で、mysql test < script
を使
用することで、誰もがバグを再現できるべきです。このリストに投稿された全て
のバグは、次の MySQL リリースで修正されるかドキュメント化されま
す! 小さなコードの変更だけですめば、我々はこの問題を修正するパッチの投
稿も行ないます。
bugs-digest-subscribe@lists.mysql.com bugs-digest
bugs
リストです。
internals-subscribe@lists.mysql.com internals
internals-digest-subscribe@lists.mysql.com internals-digest
internals
リストのダイジェストバージョン。
java-subscribe@lists.mysql.com java
java-digest-subscribe@lists.mysql.com java-digest
java
リストのダイジェストバージョン。
win32-subscribe@lists.mysql.com win32
win32-digest-subscribe@lists.mysql.com win32-digest
win32
リストのダイジェストバージョン。
myodbc-subscribe@lists.mysql.com myodbc
myodbc-digest-subscribe@lists.mysql.com myodbc-digest
myodbc
リストのダイジェストバージョン。
plusplus-subscribe@lists.mysql.com plusplus
plusplus-digest-subscribe@lists.mysql.com plusplus-digest
plusplus
リストのダイジェストバージョン。
msql-mysql-modules-subscribe@lists.mysql.com msql-mysql-modules
msql-mysql-modules-digest-subscribe@lists.mysql.com msql-mysql-modules-digest
msql-mysql-modules
リストのダイジェストバージョン。
上述したのと同じ方法で全てのリストの購読または購読中止ができます。あなた
の購読または購読中止のメッセージは、mysql
ではなく適切なメーリングリス
トに送ってください。例えば、 myodbc
リストを購読または購読中止するには、
myodbc-subscribe@lists.mysql.com または
myodbc-unsubscribe@lists.mysql.com にメールを送ります。
メーリングリストから有益な回答が得られない場合、MySQL ABに 有料のサポートを求めることもできます。有料サポートが必要な場合、 MySQL 開発チームに直接御連絡下さい( 「1.3.5 Types of Commercial Support」節参照)。
次の表は英語以外の MySQL メーリングリストを示します。注意: これら は MySQL AB によって運用されていません。そのため、我々はそれらの 品質を保証できません。
mysql-france-subscribe@yahoogroups.com フランス語メーリングリスト
list@tinc.net 韓国語メーリングリスト
subscribe mysql your@email.address
をメールしてください。
mysql-de-request@lists.4t2.com ドイツ語メーリングリスト
subscribe mysql-de your@email.address
をメールしてください。
これについては http://www.4t2.com/mysql で情報を見つけられます。
mysql-br-request@listas.linkway.com.br ポルトガル語メーリングリスト
subscribe mysql-br your@email.address
をメールしてください。
mysql-alta@elistas.net スペイン語メーリングリスト
subscribe mysql your@email.address
をメールしてください。
メーリングリストへ質問を尋ねる前に、以下の手順を踏んでください:
ここで回答が見つけられない場合は、近くの MySQL 熟練者ととも に調べて下さい。まだあなたの質問の回答が見つけられなければ、先に進み、次 のセクションの mysql@lists.mysql.com へメールを送る方法についてを読んで ください。
良いバグレポートを書くのは忍耐が要りますが、それを最初に正しく行なうこと は我々とあなたから時間を節約します。 そのバグについての完全なテストケースを含む良いバグレポートは、次のリリー スでそれが修正される可能性がとても高くなります。 この節では、かなりの、または全く我々 の助けにならないことにあなたの時間を浪費しないように、あなたがレポートを 正しく書くことを手助けします。
我々は、バグレポートまた可能ならば全ての問題についてのレポートの作成に
mysqlbug
スクリプトを使用することを奨励します。mysqlbug
は
ソース配布内の `scripts' ディレクトリ、または、バイナリ配布では
MySQL をインストールしたディレクトリ配下の `bin' ディレク
トリから見つけられます。mysqlbug
を使用できない場合は、この節に挙
げられている全ての必要な情報を含めるべきです。
mysqlbug
スクリプトは、下記の多くの情報を自動的に見つけ出すことで、
レポートの作成を手助けします。しかし、重要な何かが足りない場合、あなたの
メッセージにそれを含めてください! この節を慎重に読んで、ここで述べられ
ている全ての情報がレポート中に含まれていることを確認してください。
バグや問題を報告する通常の場所は、mysql@lists.mysql.com です。
バグを明確に示すテストケースを作ることができれば、
bugs@list.mysql.com リストにそれを投稿してください。注意: この
リストには、完全で再現可能なバグ情報を mysqlbug
スクリプトを使用
して投稿すべきです。 Windows 上で実行している場合は、OS と
MySQL バージョンの記述を含めるべきです。できれば、投稿前に
MySQL の最新の安定バージョンか開発バージョンを使用して問題をテ
ストすべきです! 含められたテストケース上で、'mysql test < script' を使
用することで、または、バグレポートに含められたシェル/Perlスクリプトを実
行することで、誰もがバグを再現できるべきです。このリストに投稿された全て
のバグは、次の MySQL リリースで修正されるかドキュメント化されま
す! 小さなコードの変更だけですめば、我々はこの問題を修正するパッチの投
稿も行ないます。
多すぎる情報を含むメッセージに答えることはできますが、少なすぎる情報を含 むものにはできないということを覚えていてください。しばしば人は事実を省い てしまいます。問題の原因をわかっていると思い、いくつかの詳細を重大でない と見なしてしまうからです。良い原則は: 何かを言おうか迷ったときには、言っ てください! 最初にあなたが十分な情報を含めなかったために、再び質問して 回答を待つことを強要されるより、数行をあなたのレポートに書く方が千倍速く て迷惑ではありません。
良くある間違いは、使用している MySQL 配布のバージョン番号を示さ ない、または MySQL をインストールしたプラットフォームを(プラッ トフォームのバージョン番号を含めて)示さない事です。これはとても関連した 情報で、100 のバグレポートのうち 99 の場合、この情報がないと役に立ちませ ん! 我々は ``何故私では動作しないの?'' のような質問をとても良く受けま す。そして我々は、要求された機能はその MySQL バージョンに実装さ れていない、または、レポート中に述べられているバグは新しい MySQL バージョンで既に修正されているであることを見つけます。時々、 エラーはプラットフォーム依存で、オペレーティングシステムとプラットフォー ムのバージョン番号を知らないことには、何も修正することはできません。
問題に関連している場合は、コンパイラについての情報も与えることを忘れない でください。しばしば人はコンパイラのバグを見つけて、問題は MySQL に関連していると考えます。多くのコンパイラはいつも開発中 で、バージョンを上げることによってより良いバージョンになります。問題がコ ンパイラに依存しているかどうかを確定するには、どのコンパイラが使用されて いるかを知ることが必要です。全てのコンパイルの問題はバグレポートとみなさ れ、それに従って報告されるべきであることに注意してください。
最も役に立つのは、問題の良い説明がバグレポートに含められることです。つま り、問題に導かれる全ての行なったことの例と、正確に記述された問題それ自身 です。良いバグレポートは、バグや問題を再現する方法を示す完全な例を含むも のです。 「G.1.6 Making a test case when you experience table corruption」節参照.
問題がエラーメッセージを与える場合、それをレポートに含めることはとても重 要です! 我々がプログラムを使用するアーカイブから何かを検索しようとする 場合、エラーメッセージはプログラムが与えたものと正確に一致する方が良いで す(大文字小文字も守られるべきです!)。どのようなエラーメッセージだったか を覚えるなんてことはしてはいけません;レポートに完全なメッセージをコピー し張りつけてください。
MyODBC での問題がある場合、MyODBC トレースファイルの生成を試みるべきです。 「8.3.7 Reporting Problems with MyODBC」節参照.
あなたのレポートを読む多くの人が 80桁ディスプレイを使用しているというこ
とを覚えておいて下さい。従って、mysql
コマンドラインツールを使用
してレポートまたはサンプルを生成する時、そのようなディスプレイの有効幅を
超える出力(例えば、EXPLAIN SELECT
ステートメント; 後述のサンプル
を見てください)には、--vertical
オプション(または \G
ステー
トメント終端)を使用すべきです。
mysqladmin version
の
実行でわかります。mysqladmin
は MySQL のインストール
ディレクトリ配下の `bin' ディレクトリに見つけられます。
uname -a
の実行によってこの情報が得られます。
mysqld
が死んだ場合は、mysqld
がクラッシュしたクエリも
レポートしてください。通常、これはロギングが有効な mysqld
の実行に
よって、見つけられます。 「G.1.5 Using log files to find cause of errors in mysqld」節参照。
mysqldump --no-data db_name tbl_name1 tbl_name2 ...
からの出力を含めて
ください。これはデータベース内の任意のテーブルについての情報を得るとても
簡単で強力な方法で、我々があなたの状況に一致するものを生成する手助けにな
ります。
SELECT
ステートメントでの速度に関するバグや問題では、
EXPLAIN SELECT ...
の出力と、少なくとも SELECT
ステートメ
ントが与える行の数を常に含めるべきです。あなたの状況について、より多くの
情報を、誰かがあなたを助けられるように、より適切に与えてください! 例え
ば、次はとても良いバグレポートの例です(もちろん mysqlbug
スクリプトで投
稿されてます):
mysql
コマンド行ツール配下での実行例(注意: 出力幅がディスプレイ装
置の80桁を超えるステートメントには、\G
ステートメント終端を使用し
てください):
mysql> SHOW VARIABLES; mysql> SHOW COLUMNS FROM ...\G <output from SHOW COLUMNS> mysql> EXPLAIN SELECT ...\G <output from EXPLAIN> mysql> FLUSH STATUS; mysql> SELECT ...; <A short version of the output from SELECT, including the time taken to run the query> mysql> SHOW STATUS; <output from SHOW STATUS>
mysqladmin variables extended-status processlist
の
出力結果をメールにを含むべきです。 これはあなたのシステムの情報を
提供します!
mysqldump
を使用し
てあなたのテーブルをダンプし、あなたの問題を説明した `README' ファ
イルを作るべきです。
tar
と gzip
または zip
を使用して、ファイルの圧縮アー
カイブを生成し、そのアーカイブを ftp
を使用して
ftp://support.mysql.com/pub/mysql/secret/ に転送してください。それか
ら問題の短い説明を mysql@lists.mysql.com に送ってください。
ftp
を使用して ftp://support.mysql.com/pub/mysql/secret/ にデー
タを転送することができます。データが本当に最高機密で我々にさえ見せたくな
い場合は、先に進んで、他の変数名等を使用してサンプルを作ってみてください。
しかしこれは最後の選択と思ってください。
mysqld
デーモン開始時に使用したオプションと
MySQL クライアントプログラム実行に使用したオプションを示してく
ださい。 mysqld
, mysql
または configure
スクリプト
へのオプションはしばしば回答へのキーになり、とても関連しています! とに
かくそれらを含めるというのは悪い考えではありません! Perl や PHP などの
モジュールを使用している場合、それらのバージョン番号も含めてください。
mysqlaccess
の出力、
mysqladmin reload
の出力、接続しようとした時に得られた全てのエラー
メッセージを含めてください! 権限をテストする時、まず mysqlaccess
を実行すべきです。その後、mysqladmin reload version
を実行し、最
後に問題が発生するプログラムでの接続を試みるべきです。mysqlaccess
はMySQL インストールディレクトリ配下の `bin' ディレクトリ
に見つけられます。
parse error
が発生する場合、構文を厳密にチェックしてください! 何
が間違っているのかを見つけられなければ、多分、使用しているクエリを
MySQL の現在のバージョンがサポートしていないということです。現
在のバージョンを使用していて、http://www.mysql.com/documentation/manual.php のマ
ニュアルがあなたの使用しているクエリ構文をカバーしていない場合は、これは
MySQL があなたのクエリをサポートしていないという意味です。この
場合、あなたの選択は、その構文をあなた自身で実装することか、
mysql-support@mysql.com に email でこれを実装するように申し込むこ
とです!
マニュアルがあなたの使用している構文をカバーしているのにMySQL
の古いバージョンを使用している場合、文法が実装された時期について
MySQL の変更履歴をチェックすべきです。 「F MySQL change history」節参照。この場合、よ
り新しいバージョンの MySQL へのアップグレードを選択できます。
myisamchk
か
CHECK TABLE
/REPAIR TABLE
文で検査し、修復を試みるべきです
「4 MySQL Database Administration」節参照.
mysqld
は 更新の最中に kill されない限りは
テーブルを絶対に破壊しません! もしなぜ mysqld
が死ぬのか
見つけた場合は、我々があなたに問題解決のための修正を提供することが、
はるかに簡単になります!
「A.1 How to Determine What Is Causing Problems」節参照
もしあなたがサポート顧客なら、より高い優先度で取り扱われるように、バグレポー トを mysql-support@mysql.com と、そして同様に、他の誰かが問題を経 験済み(そして、もしかしたら解決済み)かどうかを調べるために、適切なメーリン グリストにもクロスポストしてください。
MyODBC のバグ報告上の情報については、 「8.3.4 MyODBC での問題をどのように報告すべきか?」節 を参照 してください。
いくつかの一般的な問題の解決法のために → 「A Problems and Common Errors」節参照.
回答があなたに個人的に送られて、メーリングリストに送られていない時、回答 を要約し、あなたの問題の解決の手助けになった返事の恩恵を他の人にも与える ために、その要約をメーリングリストに送信することは、良いエチケットです!
あなたの回答が広く関心を持たれると考えられる場合、尋ねた人に個人的に直接 返事をする代わりに、メーリングリストに投稿したいと思うでしょう。オリジナ ルの投稿者以外の人もそれから恩恵を受けられるように十分一般的に回答を作成 することを試みてください。メーリングリストに投稿する場合は、あなたの回答 が以前の回答と重複していないか確認して下さい。
あなた返事の中で、質問の本質部分の要約を試みてください。質問全体を引用す ることを義務と感じないで下さい。
HTML モードを ON にしたブラウザからメールメッセージを投稿しないでくださ い! 多くのユーザはブラウザでメールを読んでいません!
(訳注: ライセンスの章については、正確さをきすため原文を併記しています。 訳文だけでなく原文に目を通してください。 もし意味の取違いを見つけたなら、takeshi@SoftAgency.co.jp に連絡してください。)
本節では MySQL のサポートとライセンシング契約について述べます。
The formal terms of the GPL license can be found at 「K GNU GENERAL PUBLIC LICENSE」節. Basically, our licensing policy and interpretation of the GPL is as follows:
古いバージョンのMySQLは より 制限されたライセンスを 有していることに気をつけて下さい。 より詳しくは、それぞれのバージョンに添付のドキュメントを御覧下さい。 もしGPLがあなたの作るアプリケーションにそぐわない場合、 https://order.mysql.com/で商用のMySQL のライセンスを購入することができます。
For normal internal use, MySQL costs nothing. You do not have to pay us if you do not want to.
A license is required if:
A license is NOT required if:
GNU Library General Public License
. The mysql
command-line
client includes code from the readline
library that is under
the GPL
.
For circumstances under which a MySQL license is required, you
need a license per machine that runs the mysqld
server. However,
a multiple-CPU machine counts as a single machine, and there is no
restriction on the number of MySQL servers that run on one
machine, or on the number of clients concurrently connected to a server
running on that machine!
If you have any questions as to whether or not a license is required for your particular use of MySQL, please read this again and then contact us. 「1.3.4.2 Contact Information」節参照.
If you require a MySQL license, the easiest way to pay for it is to use the license form on MySQL's secure server at https://order.mysql.com/. Other forms of payment are discussed in 「1.3.4.1 Payment information」節.
There are several different copyrights on the MySQL distribution: MySQL 配布における、いくつか異なるコピーライトを示します:
mysqlclient
library is licensed under the LGPL
and
programs in the `client' directory is GPL. Each file has a header
that shows which copyright is used for that file.
getopt
) library are covered
by the ``GNU LIBRARY GENERAL PUBLIC LICENSE.'' 「L GNU LESSER GENERAL PUBLIC LICENSE」節参照.
regexp
library) are covered
by a Berkeley-style copyright.
readline
) library
is covered by the ``GNU GENERAL PUBLIC LICENSE.'' 「K GNU GENERAL PUBLIC LICENSE」節参照.
This is also available as the file `COPYING' in the distributions.
One goal is that the SQL client library should be free enough that it is possible to add MySQL support into commercial products without a license. For this reason, we chose the LGPL license for the client code.
This means that you can use MySQL for free with any program that uses any of the free software licenses. MySQL is also free for any end user for his own or company usage.
However, if you use MySQL for something important to you, you may want to help secure its development by purchasing licenses or a support contract. 「1.3.5 Types of Commercial Support」節参照.
Version 3.22 of MySQL is still using a more strict license. See the documentation for that version for more information.
This section describes some situations illustrating whether or not you must license the MySQL server. Generally these examples involve providing MySQL as an integral part of a product.
Note that a single MySQL license covers any number of CPUs and
mysqld
servers on a machine! There is no artificial limit on the
number of clients that connect to the server in any way.
To determine whether or not you need a MySQL license when selling your application, you should ask whether the proper functioning of your application is dependent on the use of MySQL and whether you include the MySQL server with your product. There are several cases to consider:
mysqld
server. For example, if you've
designed your application around MySQL, then you've really made
a commercial product that requires the engine, so you need a license.
Internet Service Providers (ISPs) often host MySQL servers for their customers. With the GPL license this does not require a license.
インターネットサービスプロバイダー(ISP) は MySQL サーバーを自分のお客に 提供することもしばしばです。 GPL ライセンスでは、この場合はライセンスが要求されません。
On the other hand, we do encourage people to use ISPs that have MySQL support, as this will give them the confidence that if they have some problem with their MySQL installation, their ISP will be able to solve the problem for them (in some cases with the help from the MySQL development team).
All ISPs that want to keep themselves up-to-date should subscribe
to our announce
mailing list so that they can be aware of fatal issues
that may be relevant for their MySQL installations.
Note that if the ISP doesn't have a license for MySQL, it should give its customers at least read access to the source of the MySQL installation so that its customer can verify that it is patched correctly.
If you use MySQL in conjunction with a Web server on Unix, you don't have to pay for a license.
This is true even if you run a commercial Web server that uses MySQL, because you are not selling an embedded MySQL version yourself. However, in this case we would like you to purchase MySQL support, because MySQL is helping your enterprise.
もしあなたが UNIX 上で Webサーバー とともに MySQL を使用するなら、 ライセンスを買う必要はありません。
これはたとえ MySQL を使用した商用の Webサーバー を走らせていても、 MySQL 自身を売っていないので、ライセンスを買う必要はありません。 しかしこの場合、我々はあなたが MySQL サポート契約をすることを望みます。 なぜなら、MySQL はあなたの事業を助けているからです。
Our current license prices are shown below. To make a purchase, please visit https://order.mysql.com/.
If you pay by credit card, the currency is EURO (European Union Euro) so the prices will differ slightly.
Number of licenses | Per copy |
1-9 | 230 EURO |
10-24 | 138 EURO |
25-49 | 117 EURO |
50-99 | 102 EURO |
100-249 | 91 EURO |
250-499 | 76 EURO |
500-999 | 66 EURO |
For high volume (OEM) purchases, please contact sales@mysql.com.
For OEM purchases, you must act as the middle-man for eventual problems or extension requests from your users. We also require that OEM customers have at least an extended e-mail support contract. Note that OEM licenses only apply for products where the user doesn't have direct access to the MySQL server (embedded system). In other words, the MySQL server should only be used with the application that was supplied you.
OEM 販売をする場合、ユーザーからの問題や要望に対して、 あなたは仲買人として振る舞わなくてはなりません。 われわれは OEM の客に対し、少なくとも拡張電子メールサポート契約を要求します。 OEM ライセンスは、MySQL サーバーに直接アクセスする必要のない 製品にのみ適用されます (組み込みシステム)。 いうならば、 MySQL は、ただ、あなたが提供しているアプリケーションと共にのみ 使用されなくてはなりません。 (訳注: OEM 供給を受けた MySQL サーバーライセンスのみを単体で売ることはできないという事。)
If you have a low-margin, high-volume product, you can always talk to us about other terms (for example, a percent of the sale price). If you do, please be informative about your product, pricing, market, and any other information that may be relevant.
もしあなたが薄利多売の製品を持っているなら、他の条件についていつでも 我々と話し合うことができます(例えば売値のパーセンテージとか)。 もしあなたが製品を売りたいなら、 あなたの製品説明、値段、市場、その他関連項目を我々に知らせてください。
A full-price license is not a support agreement and includes very minimal support. This means that we try to answer any relevant questions. If the answer is in the documentation, we will direct you to the appropriate section. If you have not purchased a license or support, we probably will not answer at all.
完全な価格ライセンスはサポート協定でなく,非常に最小限のサポートを含みます. これは,我々が どんな関連質問にも答えようとする事を意味します. 返事がドキュメントにあるならば, 我々は適切なセクションをあなた示すつもりです. あなたがライセンスかサポートを購入 しなかったならば, 我々はたぶん全く答えるつもりはありません.
If you discover what we consider a real bug, we are likely to fix it in any case. But if you pay for support we will notify you about the fix status instead of just fixing it in a later release.
もしあなたが、我々が本当にバグだと考える物を見つけた場合、いかなる場合でも それを修正します。 しかし, あなたがサポートを支払うならば, 後のリリースでそれを修正する事の代わりに、 我々は修正状態に関してあなたに通知するつもりです.
More comprehensive support is sold separately. Descriptions of what each level of support includes are given in 「1.3.5 Types of Commercial Support」節. Costs for the various types of commercial support are shown below. Support level prices are in EURO (European Union Euro). One EURO is about 1.06 USD.
より包括的なサポートは別々に販売されます. それぞれのレベルのサポートが含む事に 関する記述は 「1.3.5 Types of Commercial Support」節. にあります。様々なタイプの商用サポートの価格は以下に 示します. サポートレベル価格は EURO (European Union Euro) です。 1 EURO はおよそ 1.06 USD です.
Type of support | Cost per year |
Basic e-mail support. 「1.3.5.1 Basic E-mail Support 基本電子メールサポート」節参照. | EURO 200 |
Extended e-mail support 「1.3.5.2 Extended E-mail Support 拡張電子メールサポート」節参照. | EURO 1000 |
Login support 「1.3.5.3 Login Support」節参照. | EURO 2000 |
Extended login support 「1.3.5.4 Extended Login Support」節参照. | EURO 5000 |
Telephone support 「1.3.5.5 Telephone Support」節参照. | EURO 12000 |
You may upgrade from any lower level of support to a higher level of support for the difference in price between the two support levels.
下位レベルのサポートから、それより高いレベルのサポートに、 2つのサポートの価格差分の支払いで、アップグレードが可能です。
We do also provide telephone support (mostly emergency support but also 24/7 support). This support option doesn't however have a fixed price but is negotiated for case to case. If you are interested in this option you can email sales@mysql.com and tell us about your needs.
Note that as our sales staff is very busy, it may take some time until your request is handled. Our support staff does however always answer promptly to support questions!
Currently we can take SWIFT payments, checks, or credit cards.
現在,SWIFT支払い,小切手またはクレジットカードでの支払いができます.
Payment should be made to:
Postgirot Bank AB 105 06 STOCKHOLM, SWEDEN MySQL AB BOX 6434 11382 STOCKHOLM, SWEDEN SWIFT address: PGSI SESS Account number: 96 77 06 - 3
Specify: license and/or support and your name and e-mail address.
あなたの購入ライセンス かつ/又は サポートと,名前と Eメールアドレスを記述のこと。
In Europe and Japan you can use EuroGiro (that should be less expensive) to the same account.
ヨーロッパと日本では,あなたは支払いに EuroGiro(それが高価ではない) を使用することができます.
If you want to pay by check, make it payable to ``MySQL Finland AB'' and mail it to the address below:
あなたが小切手によって支払いたいと思っているならば,それを ``MySQL Finland AB'' に支払い満期にして, 以下のアドレスに郵送してください.
MySQL AB BOX 6434, Torsgatan 21 11382 STOCKHOLM, SWEDEN
If you want to pay by credit card over the Internet, you can use MySQL AB's secure license form.
インターネット上でクレジットカードで支払いたいと思っているならば, あなたは TcXの安全なライセンスフォーム. を使用することができます.
You can also print a copy of the license form, fill it in, and send it by fax to:
また上のページのコピーを印刷して書き込み,ファックスを使って以下にそれを送ることもできます.
+46-8-729 69 05
If you want us to bill you, you can use the license form and write ``bill
us'' in the comment field. You can also mail a message to
sales@mysql.com (not mysql@lists.mysql.com
!)
with your company information and ask us to bill you.
請求書を送って欲しい場合,あなたはライセンスフォームを使用し, 注釈欄に ``請求書 希望'' を書いてください. あるいは,あなたの会社の情報を記載したメッセージを sales@mysql.com におくり, (mysql@lists.mysql.com ではありません!) 請求書を送るように我々に依頼する事もできます。
For commercial licensing, please contact the MySQL licensing team. The much preferred method is by e-mail to licensing@mysql.com. Fax is also possible but handling of these may take much longer (Fax +46-8-729 69 05).
If you represent a business that is interested in partnering with MySQL, please send e-mail to partner@mysql.com.
For timely, precise answers to technical questions about MySQL you should order one of our support contracts. MySQL support is provided by the MySQL developers so the standard is extremely high.
If you are interested in placing a banner advertisement on our Web site, please send e-mail to advertising@mysql.com.
If you are interested in any of the jobs listed in our jobs section, please send e-mail to jobs@mysql.com.
For general discussion amongst our many users, please direct your attention to the appropriate mailing list.
For general information inquires, please send e-mail to info@mysql.com.
For questions or comments about the workings or content of the Web site, please send e-mail to webmaster@mysql.com.
The following is true of all support options:
Basic e-mail support is a very inexpensive support option and should be thought of more as a way to support our development of MySQL than as a real support option. We at MySQL do give a lot of free support in all the different MySQL lists, and the money we get from basic e-mail support is largely used to make this possible.
基本電子メールサポートは非常に費用のかからないサポートオプションであり, 我々の MySQL の開発をサポートする本当のサポートオプションで、 よりよい方法として考えられるべきです.
At this support level, the MySQL mailing lists are the preferred means of communication. Questions normally should be mailed to the primary mailing list (mysql@lists.mysql.com) or one of the other regular lists (for example, win32@lists.mysql.com for Windows-related MySQL questions), as someone else already may have experienced and solved the problem you have. 「1.2.22.2 質問またはバグ報告」節参照.
このサポートレベルでは, MySQL メーリングリストはコミュニケーション を取るには好まれる方法です. 通常, 質問は主要なメーリングリスト (mysql@lists.mysql.com) か他のメーリングリストのどれかに送信されるべきで、 (例えば, Windows に関連する MySQL の質問のための win32@lists.mysql.com ) これは他の誰かが同じ問題を経験して, 既に解決しているかもしれないからです。 「1.2.22.2 質問またはバグ報告」節参照.
However, by purchasing basic e-mail support, you also have access to the support address mysql-support@mysql.com, which is not available as part of the minimal support that you get by purchasing a MySQL license. This means that for especially critical questions, you can cross-post your message to mysql-support@mysql.com. (If the message contains sensitive data, you should post only to mysql-support@mysql.com.)
REMEMBER! to ALWAYS include your registration number and expiration date when you send a message to mysql-support@mysql.com.
しかし、基本電子メールサポートを購入することによって, あなたはサポートアドレス mysql-support@mysql.com にアクセスできます. (このメールアドレスは最小の MySQL ライセンスの購入では利用不可能です。) これは特に重要な質問のために使用されており、また、mysql-support@mysql.com. とクロスポストすることも可能です。 (メッセージに機密のデータが含まれる場合、あなたは mysql-support@mysql.com. だけに送信するべきです.)
メッセージを mysql-support@mysql.com に送るときは、 迅速な応答を確実にするために、必ずあなたの登録番号と満了日付を書き添えてください。
Note that if you have encountered a critical, repeatable bug, and follow the rules outlined in the manual section of how to report bugs and send it to bugs@lists.mysql.com, we promise to try to fix this as soon as possible, regardless of your support level! 「1.2.22.3 バグや問題を報告する方法」節参照.
重要でかつ再現性のあるバグを見つけた場合は マニュアルのバグ報告方法の項にあるルールに従って bugs@lists.mysql.com宛てにメールを送ってください。 バグの重要性に関わらず可能な限り迅速に対応いたします。
Basic e-mail support includes the following types of service:
基本電子メールサポートは以下のサービスを含みます:
Extended e-mail support includes everything in basic e-mail support with these additions:
mysqld
for your situation.
Login support includes everything in extended e-mail support with these additions:
kill -9
command).
Extended login support includes everything in login support with these additions:
mysql> select MY_FUNC(col1,col2) from table;
Telephone support includes everything in extended login support with these additions:
MySQL
developers that you can phone when you have a critical
problem.
MySQL
related issues.
To get support for BDB
tables, InnoDB
tables you have
to pay an additional 30% on the standard support price for each of
the table handlers you would like to have support for.
We at MySQL AB
will help you create a proper bug report for the
table handler and submit it to the developers for the specific table
handler. We will also do our best to ensure that you will get a timely
answer or solution from the developers of the table handler.
Even if we are quite confident that we can solve most problems within a timely manner, we can't guarantee a quick solution for any problems you can get with the different table handlers. We will however do our best to help you get the problem solved.
この章では、MySQL がどのように ANSI SQL 標準に関係するかを説明し ます。MySQL は ANSI SQL 標準に対して多くの拡張を持ちます。そして、 ここでそれらが何か、またそれらの使用方法を見つけられるでしょう。また、 MySQL に足りない機能についての情報と、いくつかの違いを回避する方 法も見つけられるでしょう。
MySQL は、他の SQL データベース内に見られないであろう、いくつか
の拡張を含んでいます。あなたがそれらを使用する場合、コードは他の SQL サー
バに移行できなくなるので注意してください。いくつかのケースでは、形式
/*! ... */
のコメントを使用することで、MySQL 拡張を含む
移行可能コードを書くことができます。この場合、MySQL はコメント
内のコードを実行しますが、ほかのSQLサーバーはこれを無視します。例えば:
SELECT /*! STRAIGHT_JOIN */ col_name FROM table1,table2 WHERE ...
'!'
の後ろにバージョン番号を追加すると、文法は MySQL バー
ジョンが使用されるバージョン番号と等しいか大きい場合にのみ実行されます:
CREATE /*!32302 TEMPORARY */ TABLE (a int);
上記は バージョン 3.23.02 かそれ以上の場合という意味で、そのとき MySQL は
TEMPORARY
キーワードを使用します。
MySQL 拡張を以下に示します:
MEDIUMINT
, SET
, ENUM
そして様々な
BLOB
と TEXT
型。
AUTO_INCREMENT
, BINARY
, NULL
, UNSIGNED
そして
ZEROFILL
。
BINARY
属性であなたのフィールドを宣言すべきです。これは、MySQL
サーバホストの上で使用される ASCII 順に従って比較が実行されるようになり
ます。
db_name.tbl_name
構文を使用して違うデータベースのテーブルにアクセスできます。
いくつかのSQLサーバーは同様の機能を提供しますが、これを User space
でコールします。
MySQL は以下のようなテーブルスペースをサポートしません:
create table ralph.my_table...IN my_tablespace
.
LIKE
が許されます。
SELECT
ステートメント内の INTO OUTFILE
と
STRAIGHT_JOIN
の使用。 「6.4.1 SELECT
構文」節参照.
SQL_SMALL_RESULT
option in a SELECT
statement.
EXPLAIN SELECT
。
CREATE TABLE
ス
テートメント内の INDEX
または KEY
の使用。
「6.5.3 CREATE TABLE
構文」節参照.
CREATE TABLE
での TEMPORARY
か IF NOT EXISTS
の使用。
COUNT(DISTINCT list)
の使用。
ALTER TABLE
ステートメント内の CHANGE col_name
, DROP col_name
,
DROP INDEX
, IGNORE
, RENAME
の使用。
「6.5.4 ALTER TABLE
構文」節参照.
RENAME TABLE
の使用。 「6.5.5 RENAME TABLE
構文」節参照。
ALTER TABLE
ステートメント内の複数の ADD
, ALTER
,
DROP
, CHANGE
節の使用。
IF EXISTS
付きの DROP TABLE
の使用。
DROP TABLE
で破棄できる
DELETE
ステートメントの LIMIT
節。
INSERT
と REPLACE
ステートメントの DELAYED
節。
INSERT
, REPLACE
, DELETE
, UPDATE
ステートメント
の LOW_PRIORITY
節。
LOAD DATA INFILE
の使用。多くの場合、この構文は ORACLE の
LOAD DATA INFILE
と互換があります。 「6.4.8 LOAD DATA INFILE
構文」節参照.
ANALYZE TABLE
, CHECK TABLE
, OPTIMIZE TABLE
, and
REPAIR TABLE
ステートメント。
SHOW
ステートメント。
「4.5.5 SHOW
構文」節参照.
SET OPTION
ステートメント。 「5.5.6 SET
構文」節参照.
GROUP BY
部に全てのフィールドを持つ必要はありません。
This gives better performance for some very specific, but quite normal
queries.
「M.3 Functions for Use with GROUP BY
Clauses」節参照.
GROUP BY
とともに ASC
と DESC
を記述できます。
||
と &&
演算子を、C プログラミング言語
のように、論理和と論理積を意味すると理解します。MySQL では
||
と OR
、&&
と AND
は同義語です。この良い構
文のため、MySQL は ANSI SQL の文字列結合演算子 ||
をサポー
トしません。CONCAT()
を代わりに使用してください。CONCAT()
は任意の数の引数を使用できるので、||
演算子の使用を
MySQL に変換するのは簡単です。
CREATE DATABASE
または DROP DATABASE
.
「6.5.1 CREATE DATABASE
構文」節参照.
MOD()
と同義の %
。 N % M
は MOD(N,M)
と等価です。
%
は C プログラマーと PostgreSQL との互換のためにサポートされます。
=
, <>
, <=
,<
, >=
,>
,
<<
, >>
, <=>
, AND
, OR
, LIKE
演算子は、SELECT
文中で、FROM
の左側のフィールドの比較に
使用されます。
例えば:
mysql> SELECT col1=1 AND col2=2 FROM tbl_name;
LAST_INSERT_ID()
関数。
「8.4.3.126 mysql_insert_id()
」節参照.
REGEXP
と NOT REGEXP
正規表現演算子
CONCAT()
または CHAR()
。
MySQL では、これらの関数は任意の数の引数を取ることができます。
BIT_COUNT()
, CASE
, ELT()
,
FROM_DAYS()
, FORMAT()
, IF()
, PASSWORD()
,
ENCRYPT()
, md5()
, ENCODE()
, DECODE()
,
PERIOD_ADD()
, PERIOD_DIFF()
, TO_DAYS()
,
WEEKDAY()
関数。
TRIM()
to trim substrings. ANSI SQL only supports removal
of single characters.
GROUP BY
関数 STD()
, BIT_OR()
そして BIT_AND()
。
DELETE
+ INSERT
の代わりの REPLACE
の使用。
「6.4.7 REPLACE
構文」節参照.
FLUSH
, RESET
, DO
構文。
:=
でステートメント内での変数の設定が可能:
SELECT @a:=SUM(total),@b=COUNT(*),@a/@b AS avg FROM test_table; SELECT @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
我々は MySQL を ANSI SQL 標準と ODBC SQL 標準に従うように試みてい ますが、いくつかのケースで MySQL は何か違いがあります:
--
は空白が続く場合だけコメントになります。 「1.4.4.8 コメント開始としての `--'」節参照。
VARCHAR
フィールドでは、値が格納される時に末尾の空白が削除されます。
「1.4.7 MySQL での既知のエラーと欠けているデザイン」節参照。
CHAR
フィールドは黙って VARCHAR
フィール
ドに変更されます。 「6.5.3.1 暗黙のフィールド定義変更」節参照。
REVOKE
を発行する必
要があります。 「4.3.1 GRANT
と REVOKE
構文」節参照.
NULL AND FALSE
は FALSE
ではなく NULL
と評価されます。
このケースで、多くの余計な条件を評価する必要があることは良いことではないと、
我々は考えているからです。
--ansi
オプションつきで mysqld
を開始すると、その MySQL の
振舞いが変わります。
||
は OR
ではなく文字列結合です。
"
は(MySQL `
引用文字に似た)識別子引用文字になり、
文字列引用文字ではありません。
REAL
は DOUBLE
の同義語ではなく FLOAT
の同義語になり
SERIALIZABLE
です。
「6.7.3 SET TRANSACTION
構文」節参照.
This is the same as using --sql-mode=REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,SERIALIZE,ONLY_FULL_GROUP_BY
.
次の機能が MySQL の現在のバージョンにはありません。新しい拡張の 優先度については、次を参考にしてください the online MySQL TODO list. これはこのマニュアル中の TODO リストの最新バージョンです。 「1.6 MySQL and the future (The TODO)」節参照。
MySQL currently only supports sub selects of the form INSERT
... SELECT ...
and REPLACE ... SELECT ...
. You can however use
the function IN()
in other contexts.
しかし多くの場合、sub-select を使わないクエリに書き直すことができます:
SELECT * FROM table1 WHERE id IN (SELECT id FROM table2);
This can be re-written as:
SELECT table1.* FROM table1,table2 WHERE table1.id=table2.id;
The queries:
SELECT * FROM table1 WHERE id NOT IN (SELECT id FROM table2); SELECT * FROM table1 WHERE NOT EXISTS (SELECT id FROM table2 where table1.id=table2.id);
Can be rewritten as:
SELECT table1.* FROM table1 LEFT JOIN table2 ON table1.id=table2.id where table2.id IS NULL
さらに複雑なサブクエリでは、サブクエリを保持するために一時テーブルを作成で
きます。しかし、この方法でも動かない場合があります。このケースには、
DELETE
ステートメントでもっとも頻繁に遭遇します。DELETE
ステー
トメントでは、標準 SQL では(sub select の中を除いて)join をサポートして
いません。サブクエリが MySQL にサポートされるまで、この状況には2
つの選択肢があります。
最初の選択肢は、手続きプログラミング言語(Perl や PHP のような)を使用して、
SELECT
クエリを発行して削除されるレコードのプライマリキーを獲得し、
それから DELETE
ステートメント(DELETE FROM ... WHERE
... IN (key1, key2, ...)
)を構築するためにその値を使用することです。
二番目の選択肢は、対話型 SQL を使用し、DELETE
ステートメントのセッ
トを(標準 ||
オペレータの代わりに)MySQL 拡張
CONCAT()
を使用して、自動的に組み立てることです。例えば:
SELECT CONCAT('DELETE FROM tab1 WHERE pkid = ', tab1.pkid, ';') FROM tab1, tab2 WHERE tab1.col1 = tab2.col2;
このクエリをスクリプトファイル中に置き、入力を mysql
コマンドライン
インタプリタに切替え、その出力を二番目のインタプリタインスタンスにパイプし
ます:
prompt> mysql --skip-column-names mydb < myscript.sql | mysql mydb
MySQL 4.0 supports multi-table deletes that can be used to efficiently delete rows based on information from one table or even from many tables at the same time.
SELECT INTO TABLE
MySQL はまだ Oracle SQL extension:
SELECT ... INTO TABLE ...
をサポートしません。
MySQL は INSERT INTO ... SELECT ...
をサポートします。
これは基本的に同じことです。 「6.4.2.1 INSERT ... SELECT
構文」節参照.
INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 WHERE tblTemp1.fldOrder_ID > 100;
Alternatively, you can use SELECT INTO OUTFILE...
or CREATE
TABLE ... SELECT
to solve your problem.
MySQL は現在トランザクションをサポートするため、次の議論は非トラ
ンザクション安全テーブル型を使用する場合にだけ有効です。 「6.7.1 BEGIN/COMMIT/ROLLBACK
構文」節参照。
``なぜ MySQL はトランザクションのデータベースでないのか?'' とか ``なぜ MySQL はトランザクションをサポートしないのか?'' といった質問がしばしばなされます。
MySQL は、データの取り扱いに対し、他のパラダイム、 ``アトミック・オペレーション''をサポートする事を意図して決定しました。 アトミック・オペレーションが同等かあるいはより良いパフォーマンスを 提供するというのが、我々の経験、および考えです。 それでも、我々はトランザクション的データベースパラダイムとプランを評価し、 理解しています。次の数リリースのうちに、テーブル単位を基本に、トランザクショ ン安全テーブルを導入します。 その時我々は、ユーザーが、 スピード重視でアトミック・オペレーションを使用するのか、あるいは アプリケーションでトランザクションの機能を使うのか、 を、選択できるようにしようと考えています。
厳密に integrity 維持するには MySQL の機能をどのように使用するの でしょう? そして、トランザクション的パラダイムでこれらの機能をどのように 比較するのでしょう?
最初に、トランザクションのパラダイムでは、 もし、あなたのアプリケーションが 基本となる部分で ``commit'' の代わりに ``rollback'' の呼び出しに依存しているなら、 トランザクションはより便利になるでしょう。 おまけに、トランザクションは完了できなかった更新や不整合を起こした データが、確実にデータベースに登録されないようにできます。 そのサーバーには、自動的な rollback をする機会が与えられ、 あなたのデータは守られるでしょう。
MySQL はほとんどの場合、更新前の簡単なチェックを含ませることができたり、 あるいはデータベースの矛盾を検査して自動修復や警告の表示を行ったりする 簡単なスクリプトを実行することができるような、 ポテンシャルをあなたに提供します。 MySQL ログの使用や外部へのログの追加を行ったりする事で、 通常、データに不整合のおきたテーブルを完全に修復できることに注意してください。
さらに、``fatal'' transactional updates はアトミックで書き換えることができます。
実際、トランザクションが解決する全ての integrity problems は
LOCK TABLES
や atomic updates で置き換えることが出来、
さらにこれは、トランザクションのデータベースにある一般的な問題である、
データベースからの自動的な中断を得ること無しに、可能なはずです。
もしサーバーがダウンすればトランザクションでも全てを失うことを阻止できません。 この場合、トランザクションのシステムでもデータを全て失うでしょう。 The difference between different systems lies in just how small the time-lap is where they could lose data. No system is 100% secure, only ``secure enough.'' Even Oracle, reputed to be the safest of transactional databases, is reported to sometimes lose data in such situations.
MySQL を安全にするには、バックアップを取ることと、 更新ログを有効にすることだけです。 これで、あなたが他のトランザクションを持つデータベースで行っているような いかなる場面での修復が可能です。 もちろん、バックアップをとることは、どのデータベースを使用しているかに 関わらず、常に良いことです。
The transactional paradigm has its benefits and its drawbacks. Many
users and application developers depend on the ease with which they can
code around problems where an abort appears to be, or is necessary, and they
may have to do a little more work with MySQL to either think
differently or write more. If you are new to the atomic operations
paradigm, or more familiar or more comfortable with transactions, do not
jump to the conclusion that MySQL has not addressed these
issues. Reliability and integrity are foremost in our minds. Recent
estimates indicate that there are more than 1,000,000 mysqld
servers
currently running, many of which are in production environments. We
hear very, very seldom from our users that they have lost any data, and
in almost all of those cases user error is involved. This is, in our
opinion, the best proof of MySQL's stability and reliability.
Lastly, in situations where integrity is of highest importance,
MySQL's current features allow for transaction-level or better
reliability and integrity. If you lock tables with LOCK TABLES
, all
updates will stall until any integrity checks are made. If you only obtain
a read lock (as opposed to a write lock), then reads and inserts are
still allowed to happen. The new inserted records will not be seen by
any of the clients that have a READ
lock until they release their read
locks. With INSERT DELAYED
you can queue inserts into a local queue,
until the locks are released, without having the client wait for the insert
to complete. 「6.4.3 INSERT DELAYED
構文」節参照.
``Atomic,'' in the sense that we mean it, is nothing magical. It only means
that you can be sure that while each specific update is running, no other
user can interfere with it, and there will never be an automatic
rollback (which can happen on transaction based systems if you are not
very careful). MySQL also guarantees that there will not be
any dirty reads. You can find some example of how to write atomic updates
in the commit-rollback section. 「1.4.6 COMMIT
/ROLLBACK
なしでうまくやる方法」節参照.
We have thought quite a bit about integrity and performance, and we believe that our atomic operations paradigm allows for both high reliability and extremely high performance, on the order of three to five times the speed of the fastest and most optimally tuned of transactional databases. We didn't leave out transactions because they are hard to do. The main reason we went with atomic operations as opposed to transactions is that by doing this we could apply many speed optimizations that would not otherwise have been possible.
Many of our users who have speed foremost in their minds are not at all
concerned about transactions. For them transactions are not an
issue. For those of our users who are concerned with or have wondered
about transactions vis-a-vis MySQL, there is a ``MySQL
way'' as we have outlined above. For those where safety is more
important than speed, we recommend them to use the BDB
,
or InnoDB
tables for all their critical data. 「7 MySQL テーブル型」節参照.
One final note: We are currently working on a safe replication schema that we believe to be better than any commercial replication system we know of. This system will work most reliably under the atomic operations, non-transactional, paradigm. Stay tuned.
ストアドプロシジャは、サーバ内でコンパイルでき格納できる SQL コマンドの セットです。一度これが行なわれると、クライアントはクエリ全体の再発行を保 持する必要がなく、ストアドプロシジャを参照できます。これはさらにより速い速度を提 供します。クエリは一度だけ解釈され、より少ないデータがサーバとクライアン ト間で送信されるからです。サーバ内に関数ライブラリを持つことにより概念レ ベルを上げることもできます。
トリガは特別なイベントが発生した時に呼び出されるストアドプロシジャです。 例えば、トランザクションテーブルからレコードが削除される度にトリガされ、 トランザクションが削除された時に自動的に対応する顧客を顧客テーブルから削 除するというストアドプロシジャをインストールすることができます。
計画されている言語の更新はストアドプロシジャを処理できるようになりますが、 トリガは除きます。トリガは通常全てを、それらを必要としないクエリでさえも 遅くします。
MySQL がストアドプロシジャを得る時を知るには、 「1.6 MySQL and the future (The TODO)」節 を参照 してください。
注意: SQL の外部キーはテーブルを結合するためには使用できませんが、指示の
完全性の検査のために良く使用されます(foreign key constraints)。
SELECT
ステートメントで複数
テーブルから結果を得たい場合、テーブルの結合によってこれを行ないます:
SELECT * from table1,table2 where table1.id = table2.id;
「6.4.1.1 JOIN
構文」節参照. 「3.5.6 Using Foreign Keys」節参照.
MySQL 内での FOREIGN KEY
構文は、他の SQL ベンダの
CREATE TABLE
コマンドとの互換のためだけに存在します; これは何も行
ないません。ON DELETE ...
がない FOREIGN KEY
構文は、目的
の作成のために主に使われます。いくつかの ODBC アプリケーションは、自動的
に WHERE
節を提供するために、これを使用しますが、しかしこれは通常
簡単に無効にできます。FOREIGN KEY
は時々強制チェックとして使用さ
れます。しかし、テーブルに正しい順で行が挿入される場合、このチェックは実
際には不要です。いくつかのアプリケーションがそれが存在することを要求する
ため MySQL はこれらの節だけをサポートします(それが動作するかど
うかに関わらず)。
MySQL では、外部キーを持つテーブルからレコードを削除する時に適
切な DELETE
ステートメントをアプリケーションに追加することで、
ON DELETE ...
が実装されていないという問題を回避できます。実際に
は、これは速く(いくつかの場合はより速く)そして外部キーの使用よりもさらに
可搬性があります。
近い将来、少なくとも情報が保存され、そして mysqldump
と ODBC によっ
て取り出されるように、我々は FOREIGN KEY
実装を拡張します。
At a later stage we will
implement the foreign key constraints for application that can't easily be
coded to avoid them.
我々がどこから始めるのかわからない FOREIGN KEY
には多くの問題があ
ります:
INSERT
と UPDATE
ステートメントへの速度の影響はものすごく、
そしてこの場合、ほとんど全ての FOREIGN KEY
チェックは役に立ちませ
ん。通常は、正しいテーブルに正しい順でレコードを挿入するためです。
FOREIGN KEY ... ON DELETE
rules when
one codes an application. It's not unusual that one loses a lot of
important information just because a wrong or misused ON DELETE
rule.
外部キーの良い面は、ODBC と他のいくつかのクライアントプログラムに、どの ようにテーブルが接続されるかを見る機能を与え、これを使用して接続図を示し、 生成アプリケーションの手助けをすることだけです。
MySQL は間もなく、クライアントがどのようにオリジナル接続が作成
されたかを問い合わせ、回答を受けられるように FOREIGN KEY
定義を格
納します。現在の `.frm' ファイル形式にはそれを置く場所はありません。
MySQL はビューをサポートしません。 しかし 4.1 で組み込むことを考えています。
Views are mostly useful for letting users access a set of relations as one table (in read-only mode). Many SQL databases don't allow one to update any rows in a view, but you have to do the updates in the separate tables.
As MySQL is mostly used in applications and on web system where the application writer has full control on the database usage, most of our users haven't regarded views to be very important. (At least no one has been interested enough in this to be prepared to finance the implementation of views).
One doesn't need views in MySQL to restrict access to columns as MySQL has a very sophisticated privilege system. 「4.2 General Security Issues and the MySQL Access Privilege System」節参照.
他のいくつかの SQL データベースは、`--' をコメントの開始のために使
用します。MySQL は `#' をコメント開始文字とします。
mysql
コマンドラインツールが `--' で始まる全ての行を削除した
としてもです。MySQL では C コメントスタイル /* これはコメ
ント */
も使用できます。 「6.1.5 コメント 構文」節参照。
MySQL バージョン 3.23.3 以上は `--' をサポートしません;
この退化したコメントスタイルは、次のコードのように !payment!
の
payment の値を自動的に挿入するような何かを使用して自動的に生成される
SQL クエリで多くの問題を引き起こすためです:
UPDATE tbl_name SET credit=credit-!payment!
payment
の値が負の場合に何が起きると思いますか?
1--1
は正しい SQL なので、我々は `--' をコメント開始と見なす
ことはひどいことだと思います。
しかし MySQL バージョン 3.23 では次を使用できます:
1-- これはコメント
以降の説明では、バージョン 3.23 よりも前の MySQL を実行している場 合だけが対象です:
テキストファイルの SQL プログラムが `--' コメントを含んでいる場合、 次を使用すべきです:
shell> replace " --" " #" < text-file-with-funny-comments.sql \ | mysql database
通常の次の代わりに:
shell> mysql database < text-file-with-funny-comments.sql
次の方法でも、コマンドファイル中の `--' コメントを `#' コメン トに変更できます:
shell> replace " --" " #" -- text-file-with-funny-comments.sql
それらは次のコマンドで戻してください:
shell> replace " #" " --" -- text-file-with-funny-comments.sql
Entry level SQL92. ODBC levels 0-2.
COMMIT
/ROLLBACK
なしでうまくやる方法
以下は主に ISAM
, MyISAM
, HEAP
テーブルだけにあてはま
ります。更新にトランザクション安全なテーブル(BDB
, InnoDB
テー
ブル)だけを使用している場合、MySQL でも COMMIT
と
ROLLBACK
を行なうことができます。 「6.7.1 BEGIN/COMMIT/ROLLBACK
構文」節参照。
上記のテーブル型で COMMIT
-ROLLBACK
を効率よく操作する上での
問題は、MySQL が今日使用しているのとは、まったく異なったテーブル
レイアウトを要求することです。
この型のテーブルは、自動的にテーブルをクリーンアップする拡張スレッドも必要
とし、ディスク使用量はさらに大きくなります。 これは MySQL を現在
よりも 2~4 倍遅くしてしまいます。
今、我々は SQL サーバ言語(ストアドプロシジャのようなもの)の実装にさらに
賛成です。これで、本当に COMMIT
-ROLLBACK
を必要とするのは
めったにありません。これはさらに良い性能も与えるでしょう。
トランザクションを必要とするループは、通常は LOCK TABLES
の助けで
コード化でき、そして fly 上でレコードの更新時にはカーソルは必要としませ
ん。
我々 TcX で本当に必要としているのは、100% 標準のデータベースではなくて、 本当に速いデータベースです。速度低下なしでそれらの機能を実装する方法を見つけた ときには、我々はそれを行なうでしょう。しばらくは行なうべきさらに重要なこ とが多くあります。今の我々の優先度については TODO をチェックしてください。 高レベルのサポートを持つ顧客はこれを変えることができ、再び優先順位づけが 行なわれます。
現在の問題は実際には ROLLBACK
です。ROLLBACK
なしでも
LOCK TABLES
で COMMIT
アクションのいくつかの種類を行なうこ
とができます。ROLLBACK
をサポートするためには、更新される全ての古
いレコードを格納し、ROLLBACK
が発行された場合に開始位置に全てを戻
すように、MySQL を変更しなければなりません。単純な場合には、こ
れを行なうには難しくありません(現在の isamlog
をこの目的に使用し
ます)。しかし、ALTER/DROP/CREATE TABLE
での ROLLBACK
の実
装を行うことはとても困難です。
ROLLBACK
の使用の回避のために、次の方法を使用することができます:
LOCK TABLES ...
をアクセスしたいテーブルの全てをロックするために
使用します
UNLOCK TABLES
をロックの解除に使用します
これは普通は ROLLBACK
可能なトランザクションの使用よりも速いです
が、常にではありません。この解が処理できない状況は、更新中に誰かがスレッ
ドを kill する時だけです。この場合、全てのロックはリリースされますが、い
くつかの更新は実行されません。
1回のオペレーション中でレコードを更新する関数も使用できます。次のテクニック によってとても効率的なアプリケーションを得ることができます。
例えば、いくつかの顧客情報で更新を行なっている時、我々は変更された顧客デー
タだけを更新し、変更されていないデータはテストせず、変更されたデータに依
存して変更されたデータがオリジナルの行と比較されます。変更のテストは
UPDATE
ステートメント内の WHERE
節で行われます。レコードが
更新されなかった時は、我々はクライアントにメッセージ: "Some of the data
you have changed has been changed by another user" を与え、そしてそれか
ら古い行と新しい行をウィンドウ内で表示します。ユーザは顧客レコードのどち
らのバージョンを使用すべきかを決定できます。
これは column locking に似たものを我々に与えますが、実際には十分です。
なぜなら、我々はそれらの現在の値に関連した値を持つフィールドだけを更新するから
です。これは、典型的な UPDATE
ステートメントが次のように見えると
いうことを意味します:
UPDATE tablename SET pay_back=pay_back+'relative change'; UPDATE customer SET customer_date='current_date', address='new address', phone='new phone', money_he_owes_us=money_he_owes_us+'new_money' WHERE customer_id=id AND address='old address' AND phone='old phone';
見ての通り、他のクライアントが pay_back
または
money_he_owes_us
フィールドの値を変更したとしても、これはとても効率的で
働きます。
多くの場合、ユーザは ROLLBACK
そして/または LOCK TABLES
が
いくつかのテーブルでユニークな識別子を管理することを望みます。これは、
AUTO_INCREMENT
フィールドと SQL LAST_INSERT_ID()
関数や C API 関
数 mysql_insert_id
の使用によって、さらに効率的に処理できます。
「8.4.3.126 mysql_insert_id()
」節参照.
MySQL AB では、我々はいつでもそれを回避してコード可能なので、 我々は行レベルロックを必要としていません。本当に行ロックを必要とする ケースもありますが、しかしこれは非常にまれです。 行レベルロックを望むのなら、テーブル内でフラグ項目を使用して、 次のようにして行なえます:
UPDATE tbl_name SET row_flag=1 WHERE id=ID;
行が見つかり、オリジナル行内で row_flag
が既に 1 でない場合、
MySQL は影響された行数として 1 を返します。
MySQL が上述のクエリを次に変更したと考えることが可能です:
UPDATE tbl_name SET row_flag=1 WHERE id=ID and row_flag <> 1;
The following problems are known and have a very high priority to get fixed:
ANALYZE TABLE
on a BDB table may in some case make the table
unusable until one has restarted mysqld
. When this happens you will
see errors like the following in the MySQL error file:
001207 22:07:56 bdb: log_flush: LSN past current end-of-log
ALTER TABLE
on a BDB
table on which you are
running not completed multi-statement transactions. (The transaction
will probably be ignored).
ANALYZE TABLE
, OPTIMIZE TABLE
and REPAIR TABLE
may
cause problems on tables for which you are using INSERT DELAYED
.
LOCK TABLE ..
and FLUSH TABLES ..
doesn't
guarantee that there isn't a half-finished transaction in progress on the
table.
mysql
client on the
database if you are not using the -A
option or if you are using
rehash
. This is especially notable when you have a big table
cache.
LOAD DATA INFILE
and line terminator characters of more than 1 character.
The following problems are known and will be fixed in due time:
MATCH
only works with SELECT
statements.
SET CHARACTER SET
, one can't use translated
characters in database, table and column names.
DELETE FROM merge_table
used without a WHERE
will only clear the mapping for the table, not delete everything in the
mapped tables
BLOB
values can't ``reliably'' be used in GROUP BY
or
ORDER BY
or DISTINCT
.
これらの場合、 BLOB
の比較の際には最初の max_sort_length
バイト
(デフォルト1024)だけが使用されます。
これは mysqld
の -O max_sort_length
オプションで変更可能です。
A workaround for most cases is to use a substring:
SELECT DISTINCT LEFT(blob,2048) FROM tbl_name
.
BIGINT
or DOUBLE
(both are
normally 64 bits long). It depends on the function which precision one
gets. The general rule is that bit functions are done with BIGINT
precision, IF
, and ELT()
with BIGINT
or DOUBLE
precision and the rest with DOUBLE
precision. One should try to
avoid using bigger unsigned long long values than 63 bits
(9223372036854775807) for anything else than bit fields!
BLOB
と TEXT
はのぞいて、は、
検索されるときに最後についているスペースを自動で取り除きます。
CHAR
型ではこれは OK で、この特徴は ANSI SQL92 に従っていると見なされるでしょう。
MySQL のバグは、 VARCHAR
でも同様に行ってしまうことです。
ENUM
and SET
columns in one table.
safe_mysqld
re-directs all messages from mysqld
to the
mysqld
log. One problem with this is that if you execute
mysqladmin refresh
to close and reopen the log,
stdout
and stderr
are still redirected to the old log.
If you use --log
extensively, you should edit safe_mysqld
to
log to `'hostname'.err' instead of `'hostname'.log' so you can
easily reclaim the space for the old log by deleting the old one and
executing mysqladmin refresh
.
UPDATE
statement, columns are updated from left to right. If
you refer to an updated column, you will get the updated value instead of the
original value. For example:
mysql> UPDATE tbl_name SET KEY=KEY+1,KEY=KEY+1;This will update
KEY
with 2
instead of with 1
.
select * from temporary_table, temporary_table as t2;
RENAME
doesn't work with TEMPORARY
tables.
DISTINCT
differently if you are using
'hidden' columns in a join or not. In a join, hidden columns are
counted as part of the result (even if they are not shown) while in
normal queries hidden columns doesn't participate in the DISTINCT
comparison. We will probably change this in the future to never compare
the hidden columns when executing DISTINCT
An example of this is:
SELECT DISTINCT mp3id FROM band_downloads WHERE userid = 9 ORDER BY id DESC;and
SELECT DISTINCT band_downloads.mp3id, FROM band_downloads,band_mp3 WHERE band_downloads.userid = 9 AND band_mp3.id = band_downloads.mp3id ORDER BY band_downloads.id DESC;In the second case you may in MySQL 3.23.x get two identical rows in the result set (because the hidden 'id' column may differ). Note that the this only happens for queries where you don't have the ORDER BY columns in the result, something that is you are not allowed to do in ANSI SQL.
rollback
data) some things
behaves a little different in MySQL than in other SQL servers:
(This is just to ensure that MySQL never need to do a rollback
for a SQL command). This may be a little awkward at times as column
Because MySQL allows you to work with table types that don't
support transactions, and thus can't rollback
data, some things
behave a little differently in MySQL than in other SQL servers.
This is just to ensure that MySQL never need to do a rollback
for a SQL command. This may be a little awkward at times as column
values must be checked in the application, but this will actually give
you a nice speed increase as it allows MySQL to do some
optimizations that otherwise would be very hard to do.
If you set a column to an incorrect value, MySQL will, instead of
doing a rollback, store the best possible value
in the column:
NULL
into a column that doesn't take
NULL
values, MySQL will store 0 or ''
(empty
string) in it instead. (This behavior can, however, be changed with the
-DDONT_USE_DEFAULT_FIELDS compile option).
DATE
and DATETIME
columns. (Like 2000-02-31 or 2000-02-00).
If the date is totally wrong, MySQL will store the special
0000-00-00 date value in the column.
enum
to an unsupported value, it will be set to
the error value 'empty string', with numeric value 0.
PROCEDURE
on a query that returns an empty set,
in some cases the PROCEDURE
will not transform the columns.
MERGE
doesn't check if the underlying
tables are of compatible types.
NaN
, -Inf
and Inf
values in double. Using these will cause problems when trying to export
and import data. We should as an intermediate solution change NaN
to
NULL
(if possible) and -Inf
and Inf
to the
Minimum respective maximum possible double
value.
LIMIT
on negative numbers are treated as big positive numbers.
ALTER TABLE
to first add an UNIQUE
index to a
table used in a MERGE
table and then use ALTER TABLE
to
add a normal index on the MERGE
table, the key order will be
different for the tables if there was an old not-unique key in the
table. This is because ALTER TABLE
puts UNIQUE
keys before
normal keys to be able to detect duplicate keys as early as possible.
The following are known bugs in earlier versions of MySQL:
DROP TABLE
on a table that is
one among many tables that is locked with LOCK TABLES
.
LOCK table
with WRITE
FLUSH TABLES
UPDATE
that updated a key with
a WHERE
on the same key may have failed because the key was used to
search for records and the same row may have been found multiple times:
UPDATE tbl_name SET KEY=KEY+1 WHERE KEY > 100;A workaround is to use:
mysql> UPDATE tbl_name SET KEY=KEY+1 WHERE KEY+0 > 100;This will work because MySQL will not use index on expressions in the
WHERE
clause.
For platform-specific bugs, see the sections about compiling and porting.
This section compares MySQL to other popular databases.
This section has been written by the MySQL developers, so it should be read with that in mind. There are no factual errors contained in this section that we know of. If you find something which you believe to be an error, please contact us about it at docs@mysql.com.
For a list of all supported limits, functions, and types, see the
crash-me
Web page at
http://www.mysql.com/information/crash-me.php.
mSQL
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!
「5.1.4 The MySQL Benchmark Suite」節参照.
ORDER BY
and GROUP BY
.
DISTINCT
.
TEXT
または BLOB
フィールドの使用。
GROUP BY
and HAVING
.
mSQL
does not support GROUP BY
at all.
MySQL supports a full GROUP BY
with both HAVING
and
the following functions: COUNT()
, AVG()
, MIN()
,
MAX()
, SUM()
, and STD()
. COUNT(*)
is optimized to
return very quickly if the SELECT
retrieves from one table, no other
columns are retrieved, and there is no WHERE
clause. MIN()
and
MAX()
may take string arguments.
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 「6.3 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 節と比較できます( 「F 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 two parameters for specifying the
user and password. You may set these to NULL, NULL
for default use.
mysql_error()
は MYSQL
構造体をパラメータとして使用します。古いコードを移
行する場合、あなたの古い msql_error()
コードへパラメータを追加してください。
mSQL
はテキストのエラーメッセージしか返しません。
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 Syntax Differs from MySQLColumn 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
option for integer columns.
ZEROFILL
option for integer columns.
AUTO_INCREMENT
option for integer columns that are a
PRIMARY KEY
.
「8.4.3.126 mysql_insert_id()
」節参照.
DEFAULT
value for all columns.
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 format.
|
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.
「8.4.3.126 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 and use this.
New in Version 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
_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 wild-card 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 in an example 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
When reading the following, please note that both products are continually evolving. We at MySQL AB and the PostgreSQL developers are both working on making our respective database as good as possible, so we are both a serious choice to any commercial database.
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 knowledge of all PostgreSQL features while we know MySQL througly, we may have got some things wrong. We will however correct these when they come to our attention.
We would first like to note that PostgreSQL and MySQL are both widely used
products, but with different design goals, even if we are both striving to
be ANSI SQL compatible. This means that for some applications MySQL is
more suited, while for others PostgreSQL is more suited. When choosing
which database to use, you should first check if the database's feature set
satisfies your application. If you need raw speed, MySQL is probably your
best choice. If you need some of the extra features that only PostgreSQL
can offer, you should use PostgreSQL
.
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 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 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 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 MySQL server.
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 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.
PostgreSQL is based on a kernel with lots of contributors. In this setup it makes sense to prioritize adding a lot of new features, instead of implementing them optimally, because one can always optimize things later if there arises a need for this.
Another big difference between MySQL and PostgreSQL is 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 exceptions are the transaction engines, and the regexp library.
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. It was only recently that the PostgreSQL developers announced that their current developer group had finally had time to take a look at all the code in the current PostgreSQL release.
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 because our model gives better code consistency, more optimal and reusable code, and in our opinion, fewer bugs. Because we are the authors of the MySQL server code, we are better able to coordinate new features and releases.
On the crash-me 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 the numerical limits may be changed with startup options for respective database. The above web page is however extremely useful when you want to ensure that your applications works with many different databases or when you want to convert your application from one datbase to another.
MySQL offers the following advantages over PostgreSQL:
MySQL
is generally much faster than PostgreSQL.
「1.5.2.3 Benchmarking MySQL and PostgreSQL」節参照.
VACUUM()
once in a while to reclaim space from UPDATE
and DELETE
commands and to perform statistics analyzes that are critical to get
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,
VACUUM()
must be run very frequently, in the worst cases even
many times a day. During the VACUUM()
run, which may take hours
if the database is big, the database is from a production standpoint,
practically dead. The PostgreSQL team has fixing this on their TODO,
but we assume that this is not an easy thing to fix permanently.
PostgreSQL
.
ALTER TABLE
.
HEAP
tables or disk based MyISAM
. 「7 MySQL テーブル型」節参照.
BerkeleyDB
and InnoDB
. Because every
transaction engine performs differently under different conditions, this
gives the application writer more options to find an optimal solution for
his or her setup. 「7 MySQL テーブル型」節参照.
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 perfect for
systems where you have log files that you order for example by month.
「7.2 MERGE Tables」節参照.
INSERT
, SELECT
, and
UPDATE/DELETE
grants per user on a database or a table, MySQL allows
you to define a full set of different privileges on database, table and
column level. MySQL also allows you to specify the privilege on host and
user combinations. 「4.3.1 GRANT
と REVOKE
構文」節参照.
Drawbacks with MySQL compared to PostgreSQL:
MyISAM
tables, is
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
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
application. If not, one can always switch the trouble table to use one
of the transactional table types. 「5.3.2 テーブル・ロッキングの問題」節参照.
DELETE
and multi-table UPDATE
and in MySQL 4.1
with subselects.
PostgreSQL currently offers the following advantages over MySQL:
Note that because we know the MySQL road map, we have included in the following table the version when MySQL should support this feature. Unfortunately we couldn't do this for previous comparison, because we don't know the PostgreSQL roadmap.
Feature | MySQL version |
Subselects | 4.1 |
Foreign keys | 4.0 and 4.1 |
Views | 4.2 |
Stored procedures | 4.1 |
Extensible type system | Not planned |
Unions | 4.0 |
Full join | 4.0 or 4.1 |
Triggers | 4.1 |
Constrainst | 4.1 |
Cursors | 4.1 or 4.2 |
Extensible index types like R-trees | R-trees are planned for 4.2 |
Inherited tables | Not planned |
Other reasons to use PostgreSQL:
Drawbacks with PostgreSQL compared to MySQL:
VACUUM()
makes PostgreSQL hard to use in a 24/7 environment.
INSERT
, DELETE
, and UPDATE
.
For a complete list of drawbacks, you should also examine the first table in this section.
The only open source benchmark that we know of that can be used to benchmark MySQL and PostgreSQL (and other databases) is our own. It can be found at http://www.mysql.com/information/benchmarks.html.
We have many times asked the PostgreSQL developers and some PostgreSQL users to help us extend this benchmark to make it the definitive benchmark for databases, but unfortunately we haven't gotten any feedback for this.
We the MySQL developers have, because of this, spent a lot of hours to get maximum performance from PostgreSQL for the benchmarks, but because we don't know PostgreSQL intimately, we are sure that there are things that we have missed. We have on the benchmark page documented exactly how we did run the benchmark so that it should be easy for anyone to repeat and verify our results.
The benchmarks are usually run with and without the --fast
option.
When run with --fast
we are trying to use every trick the server can
do to get the code to execute as fast as possible. The idea is that the
normal run should show how the server would work in a default setup and
the --fast
run shows how the server would do if the application
developer would use extensions in the server to make his application run
faster.
When running with PostgreSQL and --fast
we do a VACUUM()
after every major table UPDATE
and DROP TABLE
to make the
database in perfect shape for the following SELECT
s. The time for
VACUUM()
is measured separately.
When running with PostgreSQL 7.1.1 we could, however, not run with
--fast
because during the INSERT
test, the postmaster (the
PostgreSQL deamon) died and the database was so corrupted that it was
impossible to restart postmaster. After this happened twice, we decided
to postpone the --fast
test until next PostgreSQL release. The
details about the machine we run the benchmark can be found on the
benchmark page.
Before going to the other benchmarks we know of, we would like to give some background on benchmarks:
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 is very good at and not test anything that the database is not good at. If one after this publishes the result with a single figure, things are even easier.
This would be like us measuring the speed of MySQL compared to PostgreSQL by looking at the summary time of the MySQL benchmarks on our web page. Based on this MySQL would be more than 40 times faster than PostgreSQL, something that is of course not true. We could make things even worse by just taking the test where PostgreSQL performs worst and claim that MySQL is more than 2000 times faster than PostgreSQL.
The case is that MySQL does a lot of optimizations that PostgreSQL doesn't do. This is of course also true the other way around. An SQL optimizer is a 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 you do in your application and just use these results to decide which database would be best suited for your application. The benchmark 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 other ways.
We know of two benchmark tests that claims that PostgreSQL performs better than MySQL. These both where multi-user tests, a test that we here at MySQL AB haven't had time to write and include in the benchmark suite, mainly because it's a big task to do this in a manner that is fair against all databases.
One is the benchmark paid for by Great Bridge, which you can read about at: http://www.greatbridge.com/about/press.php?content_id=4.
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, it was also totally unfair against every other database involved in the test.
NOTE: We know that not even some of the main PostgreSQL developers did like the way Great Bridge conducted the benchmark, so we don't blame them for the way the benchmark was made.
This benchmark has been condemned in a lot of postings and newsgroups so we will here just shortly repeat some things that where wrong with it.
VACUUM()
before the test) and tuned the startup for the tests,
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
optimized indexes boost performance by some margin.'' Our benchmarks
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 ten.
SELECT
s and JOIN
s (especially
after a VACUUM()
), but doesn't perform as well on INSERT
s or
UPDATE
s. The benchmarks seem to indicate that only 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.
Tim Perdue, a long time PostgreSQL fan and a reluctant MySQL user published a comparison on phpbuider.
When we became aware of the comparison, we phoned Tim Perdue about this 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 know that there are users with similar machines as his that are using MySQL with 2000 simultaneous connections doing 400 queries per second. (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 problems with many threads, such as kernels before 2.4, which had a problem with many threads on multi-CPU machines. We have documented in this manual how to fix this and Tim should be aware of 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 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 what Tim had measured.
We asked Tim if we could get access to his data so that we could repeat the benchmark and if he could check the MySQL version on the machine to find out what was wrong and he promised to come back to us about this. He has not done that yet.
Because of this we can't put any trust in this benchmark either :(
Over time things also changes and the above benchmarks are not that relevant anymore. MySQL now have a couple of different table handlers with different speed/concurrency tradeoffs. 「7 MySQL テーブル型」節参照. It would be interesting to see how the above tests would run with the different transactional table types in MySQL. PostgreSQL has of course also got new features since the test was made. As the above test are not publicly available there is no way for us to know how the database would preform in the same tests today.
Conclusion:
The only benchmarks that exist today that anyone can download and run against MySQL and PostgreSQL is the MySQL benchmarks. We here at MySQL believe that open source databases should be tested with open source tools! This is the only way to ensure that no one does tests that nobody can reproduce and use this to claim that a database is better than another. Without knowing all the facts it's impossible to answer the claims of the tester.
The thing we find strange is that every test we have seen about PostgreSQL, that is impossible to reproduce, claims that PostgreSQL is better in most cases while our tests, which anyone can reproduce, clearly shows otherwise. With this we don't want to say that PostgreSQL isn't good at many things (it is!) or that it isn't faster than MySQL under certain conditions. We would just like to see a fair test where they are very good so that we could get some friendly competition going!
For more information about our benchmarks suite 「5.1.4 The MySQL Benchmark Suite」節参照.
We are working on an even better benchmark suite, including multi user tests, and a better documentation of what the individual tests really do and how to add more tests to the suite.
このリストのすべては、それが終わるだろう順番に書かれています。
もしあなたが優先順位に影響を及ぼしたければ、どうかライセンスかサポート登録して、 我々にあなたがより速く欲しいものを言ってください。 「1.3 MySQL ライセンスとサポート」節参照.
The plan is that we in the future will support the full ANSI SQL99 standard, but with a lot of useful extensions. The challenge is to do this without sacrifying the speed or compromise the code.
We plan to make MySQL Version 4.0 a ``quick'' release where we only add some new stuff to enable others to help us with developing new features into Version 4.1. The MySQL 4.0 version should only take us about a month to make after which we want to stabilize it and start working on Version 4.1. Version 4.0 should have the following new features:
The news section for 4.0 includes a list of the features we have already implemented in the 4.0 tree. 「F.1 Changes in release 4.0.x (Development; Alpha)」節参照.
.frm
files) This will enable us
to not run out of bits when adding more table options. One will still
be able to use the old .frm
file format with 4.0. All newly created
tables will, however, use the new format.
The new file format will enable us to add new column types, more options
for keys and FOREIGN KEY
support.
mysqld
as a library. This will have the same interface as the
standard MySQL client (with an extra function to just set up
startup parameters) but will be faster (no TCP/IP or socket overhead),
smaller and much easier to use for embedded products.
One will be able to define at link time if one wants to use the
client/server model or a stand-alone application just by defining which
library to link with.
The mysqld
will support all standard MySQL features and
one can use it in a threaded client to run different queries in each
thread.
RAND()
and user variables @var
.
DELETE FROM table_name
will return the number of deleted rows. For
fast execution one should use TRUNCATE table_name
.
DELETE
on MyISAM
tables to use the record cache.
To do this, we need to update the threads record cache when we update
the .MYD
file.
ORDER BY key_name DESC
queries.
SHOW COLUMNS FROM table_name
(used by mysql
client to allow
expansions of column names) should not open the table, but only the
definition file. This will require less memory and be much faster.
SET CHARACTER SET
we should translate the whole query
at once and not only strings. This will enable users to use the translated
characters in database, table and column names.
gethostbyaddr_r()
so that we can change
ip_to_hostname()
to not block other threads while doing DNS lookups.
record_in_range()
method to MERGE
tables to be
able to choose the right index when there is many to choose from. We should
also extend the info interface to get the key distribution for each index,
of analyze
is run on all sub tables.
SET SQL_DEFAULT_TABLE_TYPE=[MyISAM | INNODB | BDB | HEAP]
.
select id from t where grp in (select grp from g where u > 100)
select a.col1, b.col2 from (select max(col1) as col1 from root_table ) a, other_table b where a.col1=b.col1This could be done by automatically creating temporary tables for the derived tables for the duration of the query.
PREPARE
of statements and sending of parameters to mysqld
.
INSERT ... SELECT
to optionally use concurrent inserts.
RENAME DATABASE
. To make this safe for all table handlers,
it should work as follows:
RENAME
command.
SELECT MIN(column)
... GROUP BY
.
long_query_time
with a granularity
in microseconds.
mysql
command line client, with
options like database in use, time and date...
MERGE
tables.
myisampack
code into the server.
INSERT/DELETE/UPDATE
so that we
can gracefully recover if the index file gets full.
ALTER TABLE
を
実行した場合、一時テーブルをこの disk に作成するようにする
DATE/DATETIME
type that handles time zone information
properly, so that dealing with dates in different time zones is easier.
MyISAM
)
without threads.
INSERT SQL_CONCURRENT
and mysqld --concurrent-insert
to do
a concurrent insert at the end of the file if the file is read-locked.
FOREIGN
キーの定義を記憶する。
DELETE
lockd
works with modern Linux kernels; If not, we have
to fix lockd
! To test this, start mysqld
with
--enable-locking
and run the different fork* test suits. They shouldn't
give any errors if lockd
works.
LIMIT
, like in LIMIT @a,@b
.
UPDATE
statements. For example:
UPDATE TABLE foo SET @a=a+b,a=@a, b=@a+c
GROUP BY
, as in the following example:
SELECT id, @a:=count(*), sum(sum_col)/@a FROM table_name GROUP BY id
.
DEFAULT
values to columns. Give an error when using
an INSERT
that doesn't contain a column that doesn't have a
DEFAULT
.
SELECT CACHED ...
mysql_query()
commands in a row
without reading results or give a nice error message when one does this.
BIT
型を 1 bit 取るように最適化 (今 BIT
は一文字とります)
ctime()
が動かないか検証。
TIMESTAMP
と AUTO_INCREMENT
フィールドを更新しないように、
IMAGE
オプションを LOAD DATA INFILE
に追加。
LOAD DATE INFILE.. UPDATE
syntax.
LOAD DATA INFILE ... REPLACE INTO
is now.
LOAD DATA INFILE
に以下の文を理解させる:
LOAD DATA INFILE 'file_name.txt' INTO TABLE tbl_name TEXT_FIELDS (text_field1, text_field2, text_field3) SET table_field1=concatenate(text_field1, text_field2), table_field3=23 IGNORE text_field3 This can be used to skip over extra columns in the text file, or update columns based on expressions of the read data...
LOAD DATA INFILE 'file_name' INTO TABLE 'table_name' ERRORS TO err_table_name
This would cause any errors and warnings to be logged into the err_table_name
table. That table would have a structure like:
line_number - line number in data file error_message - the error/warning message and maybe data_line - the line from the data file
VARCHAR
のサポート (MyISAM にはこのサポートが既にあります)
mysql
から自動的に netscape に出力
LOCK DATABASES
. (いろいろなオプション付きで)
DECIMAL
と NUMERIC
型は 指数表示の数字を読むことが出来ません:
これを修正するには、
Field_decimal::store(const char *from,uint len)
を再コードしなくてはなりません
t1 JOIN t2 ON ...
と t1 JOIN t2 USING ...
の使用の追加。
現在、 LEFT JOIN
のみが使用できます。
unsigned long long
型の完全なサポート。
show status
にもっと多くの変数を。
INSERT
/DELETE
/UPDATE
文のカウント。
レコードの読み込みと更新のカウント。
1テーブルでのSELECTとJOINを伴ったSELECTのカウント。
SELECT 中のテーブルの数のカウント。
キーバッファの reaad/write のヒット数(理論値と実数)のカウント。
ORDER BY
, GROUP BY
, 一時テーブルの作成のカウント
mysql
を中断した場合、あなたは他から接続して
走っているクエリを kill しなくてはなりません。
最終的には、こういったことはサーバー内で検知されるように試みるべきです。
SHOW INFO FROM tbl_name
では実行されるべきです。
NATURAL JOIN
and UNION JOIN
select a from crash_me left join crash_me2 using (a)
; In this
case a is assumed to come from the crash_me table.
ON
and USING
works with the JOIN
join type.
CONNECT BY PRIOR ...
to search hierarchy structures.
mysqladmin copy database new-database
. -- Requires COPY command to be
added to mysqld
SHOW HOSTS
for printing information about the hostname cache.
DELETE
と REPLACE
オプションを UPDATE
文に追加。 (
これは更新中に起こったキーの重複エラーのあるレコードを
全て削除するでしょう).
DATETIME
to store fractions of seconds.
NULL
for calculated columns.
SELECT COUNT(*)*(id+0) FROM table_name GROUP BY id
ALTER TABLE
doesn't abort clients that executes
INSERT DELAYED
.
UPDATE
clause contains the old
values before the update started.
myisamchk
, REPAIR
and OPTIMIZE TABLE
should be able
to handle cases where the data and/or index files are symbolic links.
pread()
/pwrite()
on Windows to enable
concurrent inserts.
SUM(DISTINCT)
ANY()
,EVERY()
and SOME()
group functions. In
ANSI SQL these only works on boolean columns, but we can extend these to
work on any columns/expressions by applying: value == 0 -> FALSE and
value <> 0 -> TRUE.
MAX(column)
is the same as the column type.
create table t1 (a DATE); insert into t1 values (now()); create table t2 select max(a) from t1; show columns from t2;
UPDATE
the row
if it exists and INSERT
a new row if the row didn't exist.
(Like REPLACE
works with INSERT
/ DELETE
)
get_changed_tables(timeout,table1,table2,...)
update items,month set
items.price=month.price where items.id=month.id;
;
SHOW
commands.
SET TIMESTAMP=#;
UNION
, MINUS
, INTERSECT
and FULL OUTER JOIN
.
(Currently only LEFT OUTER JOIN
is supported)
UNIQUE
on fields that can be NULL
.
SQL_OPTION MAX_SELECT_TIME=#
to put a time limit on a query.
LIMIT
to retrieve data from the end.
safe_mysqld
: according to FSSTND (which
Debian tries to follow) PID files should go into `/var/run/<progname>.pid'
and log files into `/var/log'. It would be nice if you could put the
"DATADIR" in the first declaration of "pidfile" and "log", so the
placement of these files can be changed with a single statement.
zlib()
for gzip
-ed files to LOAD DATA INFILE
.
BLOB
columns (partly solved now).
AUTO_INCREMENT
value when one sets a column to 0.
Use NULL
instead.
JOIN
with parentheses.
GET_LOCK
. When doing this,
one must also handle the possible deadlocks this change will introduce.
Time is given according to amount of work, not real time.
Go to the first, previous, next, last section, table of contents.