MySQL Performance Blog. July 30, 2006 by Peter Zaitsev30 Comments MySQL is known for its stability but as any other application it has bugs so it may crash sometime.
Also operation system may be flawed, hardware has problems or simply power can go down which all mean similar things – MySQL Shutdown is unexpected and there could be various inconsistences. And this is not only problem as we’ll see. MySQL has angel process mysqld_safe which will restart MySQL Server in most cases. It is great, unless you have run into some bug which causes it to crash again – such crashes qucikly following one another are kind of worse because they explore many less tested code paths in MySQL and so problem potential is larger.
So lets look at the problem which happen during the crash which might need to take care of or which may seriously affect MySQL Performance. MyISAM Corruption – If you’re writting to MyISAM tables there is very large chance of them becoming corrupted during the crash. Full text search in Ruby on Rails 2 - MySQL. My previous post compared MySQL and ferret full text search engines.
For our project, the ferret was the winner. Nevertheless, I will try to show the beauty and simplicity of using MySQL indexes. Create table and indices First of all it is necessary to create table and the corresponding index. CREATE TABLE articles( id integer NOT NULL PRIMARY KEY AUTO_INCREMENT, title varchar(20), body varchar(100), fulltext(title, body)) engine = MyISAM;<BR> or create index after the table exists. CREATE fulltext INDEX x_f_articles_body ON articles(body); Please note the MyISAM engine. And now, let’s insert some data INSERT INTO articles(title, body) SELECT "Databases and IT", "Todays world ... database... Query syntax Querying is simple. SELECT * FROM articles WHERE match(title,body) against ("Databases"); or you can create query looking for all database related articles SELECT * FROM articles WHERE match(title,body) against ("Databases" WITH query expansion); See also the record ID=5. This is useful. Search.
MySQL 3.23, 4.0, 4.1 Reference Manual. Using, Abusing and Scaling MySQL at Flickr. KfWiki: Fix broken relay logs. What to tune in MySQL Server after installation. My favorite question during Interview for people to work as MySQL DBAs or be involved with MySQL Performance in some way is to ask them what should be tuned in MySQL Server straight after installation, assuming it was installed with default settings.
I’m surprised how many people fail to provide any reasonable answer to this question, and how many servers are where in wild which are running with default settings. Even though you can tune quite a lot of variables in MySQL Servers only few of them are really important for most common workload. After you get these settings right for your initial MySQL performance tuning, other changes will most commonly offer only incremental performance improvements. key_buffer_size – Very important if you use MyISAM tables. Set up to 30-40% of available memory if you use MyISAM tables exclusively. Innodb_buffer_pool_size This is very important variable to tune if you’re using Innodb tables.
Table_cache – Opening tables can be expensive. Peter Zaitsev. MyISAMからInnoDBへ切り替えるときの注意点. MySQLを使い始めて間もない人がよく陥る罠の中に、気づくと使ってるストレージエンジンがMyISAMだった!
ということがある。 デフォルトのストレージエンジンはMyISAMなので、MySQLに詳しくない人たちが比較的陥りやすい罠なのだ。 そもそもストレージエンジンという概念自体がMySQL独自のものなので仕方のない話である。 MyISAMは素晴らしいストレージエンジン(たとえばこのYahoo! の中の人による投稿で言われているように)であるが、長所もあれば短所もある。 とはいえ、MyISAMは非常に使いやすい上に高速なストレージエンジンであり、全文検索機能やテーブル圧縮など他のエンジンにはない特徴を備えているので、意図的にMyISAM上でアプリケーションを作り込んでいる場合には何ら問題はない。 MyISAMからの乗り換えで筆頭に上がるのはInnoDBであるが、二つのストレージエンジンはまったく違う特性を備えているので移行には注意が必要である。
1. InnoDBのデータ領域は16KBごとにページ化されており、さらにMVCCのためのメタデータ(タイムスタンプや削除フラグなど)を行ごとに持っているため、消費するデータサイズは大きくなってしまう。 2. MyISAMの場合、クエリが失敗するのは何か致命的なエラーが起こった場合であることが多いのであまり重要視されていない。 また、もっと基本的なことであるが、AUTO COMMITモードを使用していないときには、COMMITを明示的に発行する処理が必要になる。 3. InnoDBはデッドロック検知機能があり、デッドロックが発生した場合には即座に片方のトランザクションをロールバックすることができる。 このような理由があるので混在は望ましくない。 4. MyISAMの独創的かつ特徴的な機能として全文検索機能がある。 DSAS開発者の部屋:5分でできる、MySQLのメモリ関係のチューニング! MySQLのチューニングにおいて非常に重要となるメモリ(バッファ)関連のパラメータについて、 チューニングのポイント DSASのとあるDBサーバ(実メモリ4GB)の実際の設定値 をまとめてみます。
また、必要メモリの総量の計算や限界値を越えてないかチェックしてくれるスクリプトも紹介します。 是非、参考にしてみてください! まず最初に注意点を。 グローバルバッファ スレッドバッファ グローバルバッファはmysqld全体でそのバッファが1つだけ確保されるもので、 これに対し、 スレッドバッファはスレッド(コネクション)ごとに確保されるものです。 チューニングの際にはグローバル/スレッドの違いを意識するようにしましょう。 Innodb_buffer_pool_size 用途 InnoDBのデータやインデックスをキャッシュするためのメモリ上の領域です。 バッファ種別 グローバル DSAS値. Free MySQL GUI Windows Manager Management Client Tool, Admin, MySQL Manager, Query Browser, Editor, Software.