MySQLマニュアル(html)に章番号とかが欲しい

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの最終日25日目です.


 かつてないほど(当社比)にMySQLのマニュアルに触れた25日間も今日が最終日。毎日面白いこと探しのためにマニュアルを眺めていると、不便に感じることがあります。それは、「htmlマニュアルの左側のブロックにあるインデックス(もくじ)に章などの番号がないこと」です。

f:id:sakaik:20151225214915j:plain

 クリックしてマニュアル本体を表示させれば、そちら側には番号があるのですが、第何章を見たいと思った時に、なかなか一発で希望の章に到達できませんし、やはり章番号のついていない目次は、のっぺりとしていて高さの壁を一層つらく感じてしまいます。

 ということで、おそるおそる希望を出してみました。bugs に書くのは、もしかしたら初めてなのかも。(昔なにかを書いた気がするのは、別アカウントだったからなのか記憶違いなのか、とにかく履歴には出てこないので。。)
 こんな感じでよかったのでしょうか。>諸先輩方

https://bugs.mysql.com/bug.php?id=79769

シビアさS4で出しちゃったからか、まだ誰も相手にしてくれませんが、たぶんちょっとしたことだと思うので、対応してくれたらいいなぁと願っています。



それから、MySQL 5.6 の日本語マニュアルには PDF でのダウンロードが提供されていません。きっとPDF作成時のフォントの問題だと思うのですが、PDFでも欲しいですよね。たぶん非ネイティブにはふぉんとに難しい問題なのかもしれませんが。。これも bugs に上げていい話題なのかしらん。。


 ということで、なんとか書き切った「ひとりアドヴェントカレンダー」。苦し紛れの日もあり、心から書きたかった話題を書いた日もあり、ひとつくらいは読んで下さった方のお役に立てたことがあれば嬉しいです。


私にとっては、マニュアル読むぞと大騒ぎした結果、yoku0825さんの血豆の滲むような、この努力の話を聞けたこと*1が、大きな収穫でした。このマニュアル(しかもバージョン5.1の、日本語への翻訳が必要な日本語マニュアル)を3度も読んだというのが、今のyokuさんのベースになっているのだと、納得しました。 やっぱり yokuさんはよく読んでる。

www.slideshare.net



 毎日少しマニュアルを読んで翌日はまた別の話題に移る、というのが、意外にもストレスだったので、今後は書きたい内容や情報がある程度まとまってから書きたいと思います。25日間お付き合いして下さった方がもし居たとしたら、ありがとうございました!メリークリスマス。

*1:1年半ほど前のものでしたが見落としていました

MySQLサーバの複数立ち上げ

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの24日目のぶんです.


 MySQLサーバは、1台のマシン(というか、ひとつのOS)の上に複数立ち上げることができます。1台でレプリケーションの実験をしたり、複数のバージョンの動作を比較してみたい時などに便利です。
原理としては、データディレクトリとポートをそれぞれの mysqld プロセスごとに用意すれば良いわけですが、このあたりのことも、その他のオプションを含め、ちゃんとマニュアルにくわしく説明されています。


MySQL :: MySQL 5.7 Reference Manual :: 5.3 Running Multiple MySQL Instances on One Machine

5.3.1 Setting Up Multiple Data Directories
5.3.2 Running Multiple MySQL Instances on Windows
    5.3.2.1 Starting Multiple MySQL Instances at the Windows Command Line
    5.3.2.2 Starting Multiple MySQL Instances as Windows Services
5.3.3 Running Multiple MySQL Instances on Unix
5.3.4 Using Client Programs in a Multiple-Server Environment

 基本的な事項の説明のほか、WindowsUNIX系 それぞれについての節が設けられています。

 この章で説明されている手順で、手作業により複数の mysqld を実行することもできますが、複数立ち上げを助けてくれる、mysqld_multiというスクリプトもあります。
これは別の章にて説明されています。
MySQL :: MySQL 5.7 Reference Manual :: 4.3.4 mysqld_multi — Manage Multiple MySQL Servers

なお、この mysqld_multi は、UNIX系のみでなく、Windows版のアーカイブにも含まれています。mysqld_multi.pl という名前で、一応中身には Windows 用のパス定義が書かれていたりするので、ちゃんと動作することを意図したものだと思われます(動かしたことがないので、わからない)。


最近こういうのを全然試せていないので、落ち着いたら*1、試してみたいところです。「積ん試したいもの」が、こうして増えていく。。。

*1:と言っているといつまでも落ち着かないので「落ち着かせて」ですね

MySQL Workbench のマニュアルは本体とは別にあった

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの23日目です.


 こんにちは!つらいです!
マニュアルをふわふわと眺めるだけのフェーズを過ぎて、やはり、ひとつひとつ実際に試してみたいフェーズに入ってきました。毎日数十分程度の時間じゃぁできません。。
ということで本日はライトな話題で。

 MySQLのリファレンスマニュアルには、最終章(26章)に、「MySQL Workbench」という章があります。
ただひとつの節からなるシンプルな章だなぁと思って、中身を読んだことがなかったのですが、ちゃんと見てみたら、MySQL本体マニュアルとは別に、Workbench 専用のマニュアルがあると、書かれていました。しかも、このページ内にある唯一のリンクで、すぐに気づきそうなものなのに。。。

 ちなみに、本マニュアルによると MySQL Workbenchは、MySQL 5.1以上に対応。5.0でも動くけどいくつかの機能がサポートされない、4.x シリーズはサポートされない、とのことです。


 さて、その MySQL Workbench のマニュアルは、こちら。
http://dev.mysql.com/doc/workbench/en/

 バージョン番号が含まれないのですね。ここで現在公開されているのは、MySQL Workbench 6 (6.0~6.3) のマニュアルとなります。


MySQL Workbench の全もくじを以下に掲載します。
みんなだいすき「Extending」の説明もありますよ!

MySQL Workbench Table of Contents

1 General Information
    1.1 What Is New in MySQL Workbench 6
        1.1.1 New in MySQL Workbench 6.3
        1.1.2 New in MySQL Workbench 6.2
        1.1.3 New in MySQL Workbench 6.1
        1.1.4 New in MySQL Workbench 6.0
    1.2 MySQL Workbench Editions
2 Installation
    2.1 System Requirements
    2.2 Command-line options
    2.3 MySQL Workbench on Windows
        2.3.1 Installing
        2.3.2 Launching
        2.3.3 Uninstalling
    2.4 MySQL Workbench on Linux
        2.4.1 Installing
        2.4.2 Launching
        2.4.3 Uninstalling
    2.5 MySQL Workbench on OS X
        2.5.1 Installing
        2.5.2 Launching
        2.5.3 Uninstalling
3 Configuration
    3.1 User Accessibility Options
    3.2 Workbench Preferences
        3.2.1 General Editors Preferences
        3.2.2 SQL Editor Preferences
        3.2.3 Administration Preferences
        3.2.4 Modeling Preferences
        3.2.5 Fonts and Colors Preferences
        3.2.6 Other Preferences
    3.3 MySQL Workbench Settings and Log Files
    3.4 Tutorial: Add a Custom Link to the Home Page
    3.5 Common Preferences and Configurations
4 The Home Screen
5 MySQL Connections
    5.1 Creating A New MySQL Connection (Simple)
    5.2 Creating A New MySQL Connection (Tutorial)
    5.3 Manage Server Connections
        5.3.1 Standard TCP/IP Connection Method
        5.3.2 Local Socket/Pipe Connection Method
        5.3.3 Standard TCP/IP over SSH Connection Method
        5.3.4 SSL Wizard  (Certificates)
        5.3.5 System Profile
        5.3.6 Configure Server Management Wizard
        5.3.7 The Password Storage Vault
    5.4 MySQL Fabric Integration
    5.5 Client Connections
6 Administrative Tasks
    6.1 Server Management
        6.1.1 MySQL Connection Navigator
        6.1.2 Server Logs
        6.1.3 Service Control
        6.1.4 Configuration  (options file)
    6.2 Users and Privileges
    6.3 Server Status
    6.4 Status and System Variables
    6.5 Data Export and Import
        6.5.1 Table Data Export and Import Wizard
        6.5.2 SQL Data Export and Import Wizard
        6.5.3 Result Data Export and Import
    6.6 MySQL Audit Inspector Interface
    6.7 MySQL Enterprise Backup Interface
        6.7.1 General Requirements
        6.7.2 Online Backup
        6.7.3 Backup Recovery
    6.8 MySQL Enterprise Firewall Interface
    6.9 The wbcopytables Tool
7 Performance Tools
    7.1 Performance Dashboard
    7.2 Performance Schema Reports
    7.3 Visual Explain Plan
    7.4 Query Statistics
    7.5 Tutorial: Using Visual Explain to improve query performance
8 Database Development
    8.1 Visual SQL Editor
        8.1.1 SQL Query Window
        8.1.2 SQL Query Window Toolbar
        8.1.3 Query and Edit Menus
        8.1.4 Results Window
        8.1.5 SQL Snippets tab
        8.1.6 Context Sensitive Help
        8.1.7 Output History Panel
        8.1.8 Table Data Search Panel
        8.1.9 Export  /  Import a Table
        8.1.10 Tutorial:  Adding Data
        8.1.11 The MySQL Table Editor
        8.1.12 Code Generation Overview
    8.2 Object Management
        8.2.1 Object Browser and Editor Navigator
        8.2.2 Session and Object Information Panel
        8.2.3 Schema and Table Inspector
9 Database Design  /  Modeling
    9.1 Modeling Interface
        9.1.1 Model Editor
        9.1.2 EER Diagram Editor
        9.1.3 Creating Tables
        9.1.4 Creating Foreign Key Relationships
        9.1.5 Creating Views
        9.1.6 Creating Routines and Routine Groups
        9.1.7 Creating Layers
        9.1.8 Creating Notes
        9.1.9 Creating Text Objects
        9.1.10 Creating Images
    9.2 Additional Modeling Tools
        9.2.1 Printing Diagrams
        9.2.2 DBDoc Model Reporting
        9.2.3 Schema Validation Plugins
    9.3 Modeling Tutorials
        9.3.1 Creating a Model
        9.3.2 Basic Modeling
        9.3.3 Importing a Data Definition SQL Script
        9.3.4 Using the Default Schema
        9.3.5 Documenting the sakila Database
    9.4 Forward and Reverse Engineering
        9.4.1 Forward Engineering
        9.4.2 Reverse Engineering
    9.5 Schema Synchronization and Comparison
        9.5.1 Database Synchronization
        9.5.2 Compare and Report Differences in Catalogs
    9.6 Table Templates
    9.7 Customizing DBDoc Model Reporting Templates
        9.7.1 Supported Template Markers
        9.7.2 Creating a Custom Template
10 Database Migration Wizard
    10.1 General installation requirements
        10.1.1 ODBC Libraries
        10.1.2 ODBC Drivers
    10.2 Migration Overview
        10.2.1 A visual guide to performing a database migration
        10.2.2 Migrating from supported databases
        10.2.3 Migrating from unsupported (generic) databases
    10.3 Conceptual DBMS equivalents
    10.4 Microsoft Access Migration
    10.5 Microsoft SQL Server migration
        10.5.1 Preparations
        10.5.2 Drivers
        10.5.3 Connection Setup
        10.5.4 Microsoft SQL Server Type Mapping
    10.6 PostgreSQL migration
        10.6.1 Preparations
        10.6.2 Drivers
        10.6.3 Connection Setup
        10.6.4 PostgreSQL Type Mapping
    10.7 MySQL migration
    10.8 Using the MySQL Workbench Migration Wizard
        10.8.1 Connecting to the databases
        10.8.2 Schemata Retrieval and Selection
        10.8.3 Reverse Engineering
        10.8.4 Object Selection
        10.8.5 Migration
        10.8.6 Manual Editing
        10.8.7 Target Creation Options
        10.8.8 Schema Creation
        10.8.9 Create Target Results
        10.8.10 Data Transfer and Migration Setup
        10.8.11 Bulk Data Transfer
        10.8.12 Migration Report
    10.9 MySQL Workbench Migration Wizard FAQ
    
A MySQL Workbench Frequently Asked Questions
B Keyboard Shortcuts
C Extending Workbench
 C.1 GRT and Workbench Data Organization
 C.2 Modules
 C.3 Plugins  /  Tools
 C.4 Adding a GUI to a Plugin Using MForms
 C.5 The Workbench Scripting Shell
  C.5.1 Exploring the Workbench Scripting Shell
  C.5.2 The Shell Window
  C.5.3 The Files, Globals, Classes, Modules, and Notifications Tabs
 C.6 Tutorial:  Writing Plugins
D How To Report Bugs or Problems
E MySQL Enterprise Features
F MySQL Utilities
G Third Party Licenses
 G.1  .NET Flat TabControl License
 G.2 ANTLR ECMA Grammar License
 G.3 ANTLR License
 G.4 Bitstream Vera License
 G.5 Boost Library License
 G.6 Cairo License
 G.7 CTemplate (Google Template System) License
 G.8 cURL  (libcurl)  License
 G.9 DockPanel Suite License
 G.10 Dojo Toolkit v1.7.0b1 License
 G.11 FreeTDS License
 G.12 GDAL/OGR License
 G.13 GLib License (for MySQL Workbench)
 G.14 Glitz License
 G.15 GNU Lesser General Public License Version 2.1, February 1999
 G.16 HtmlRenderer (System.Drawing.Html)
 G.17 iODBC License
 G.18 Libiconv License
 G.19 Libintl License
 G.20 libpng License
 G.21 Libxml2 License
 G.22 Libzip License
 G.23 Lua  (liblua)  License
 G.24 Paramiko License
 G.25 PCRE License
 G.26 Pixman License
 G.27 PROJ.4 License
 G.28 PyCrypto  2.6 License
 G.29 PyODBC License
 G.30 PySQLite License
 G.31 Python License
 G.32 Python-ecdsa License
 G.33 Scintilla License
 G.34 ScintillaNET License
 G.35 SQLCipher License
 G.36 TinyXML License
 G.37 TreeViewAdv for .NET License
 G.38 VSQLite++  License
 G.39 zlib License


少し見通しが悪いので、レベル2までのもくじも載せておきます。

MySQL Workbench Table of Contents

1 General Information
    1.1 What Is New in MySQL Workbench 6
    1.2 MySQL Workbench Editions
2 Installation
    2.1 System Requirements
    2.2 Command-line options
    2.3 MySQL Workbench on Windows
    2.4 MySQL Workbench on Linux
    2.5 MySQL Workbench on OS X
3 Configuration
    3.1 User Accessibility Options
    3.2 Workbench Preferences
    3.3 MySQL Workbench Settings and Log Files
    3.4 Tutorial: Add a Custom Link to the Home Page
    3.5 Common Preferences and Configurations
4 The Home Screen
5 MySQL Connections
    5.1 Creating A New MySQL Connection (Simple)
    5.2 Creating A New MySQL Connection (Tutorial)
    5.3 Manage Server Connections
    5.4 MySQL Fabric Integration
    5.5 Client Connections
6 Administrative Tasks
    6.1 Server Management
    6.2 Users and Privileges
    6.3 Server Status
    6.4 Status and System Variables
    6.5 Data Export and Import
    6.6 MySQL Audit Inspector Interface
    6.7 MySQL Enterprise Backup Interface
    6.8 MySQL Enterprise Firewall Interface
    6.9 The wbcopytables Tool
7 Performance Tools
    7.1 Performance Dashboard
    7.2 Performance Schema Reports
    7.3 Visual Explain Plan
    7.4 Query Statistics
    7.5 Tutorial: Using Visual Explain to improve query performance
8 Database Development
    8.1 Visual SQL Editor
    8.2 Object Management
9 Database Design  /  Modeling
    9.1 Modeling Interface
    9.2 Additional Modeling Tools
    9.3 Modeling Tutorials
    9.4 Forward and Reverse Engineering
    9.5 Schema Synchronization and Comparison
    9.6 Table Templates
    9.7 Customizing DBDoc Model Reporting Templates
10 Database Migration Wizard
    10.1 General installation requirements
    10.2 Migration Overview
    10.3 Conceptual DBMS equivalents
    10.4 Microsoft Access Migration
    10.5 Microsoft SQL Server migration
    10.6 PostgreSQL migration
    10.7 MySQL migration
    10.8 Using the MySQL Workbench Migration Wizard
    10.9 MySQL Workbench Migration Wizard FAQ
    
A MySQL Workbench Frequently Asked Questions
B Keyboard Shortcuts
C Extending Workbench
D How To Report Bugs or Problems
E MySQL Enterprise Features
F MySQL Utilities
G Third Party Licenses

MySQLマニュアル、5.6と5.7の違い(Level 2)

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの22日目です.

 昨日の日記では、MySQLマニュアルのもくじより、レベル1(章レベル)の相違点について紹介しました。
今日は、その続きで、レベル2(節レベル)の相違を見ていきます。
なお、ここで章番号は、MySQL 5.7 マニュアルの章番号で書きます(MySQL 5.6 のマニュアルではなく)。


まず第1章General Information より、 1.5 に新たな節が追加されています。
1.5 Server and Status Variables and Options Added, Deprecated, or Removed in MySQL 5.7
MySQL 5.7 では多くの変数類(サーバ変数、ステータス変数、オプション)が変更になっています。過去の悪しきしがらみとの決別をようやくこのバージョンで決断したな、と評価できるところもあり、そんな情報がここにまとめられています。

続いて、11章と12章。MySQL 5.7 でJSON対応したのを受けて、各章に JSON型についての説明および、JSON関係の関数についての説明の節が追加されました。
11.6 The JSON Data Type
12.16 JSON Functions


14章。細かいことですが、14.6節が、従来の「InnoDB Table Compression」から「InnoDB Table and Page Compression」へと変更されています。圧縮が、テーブルだけでなくページも対象に加わったということでしょうか(中身はまだ読んでない)。
14.6 InnoDB Table and Page Compression

17.1は、表現上の変更なので、良いでしょう。
(Replication Configuration から Configuring Replication へ)

18章の前にあった MySQL Cluster(NDB)の章が除外されたので、18章から21章まで、MySQL 5.6マニュアルの章とひとつずつずれます。(MySQL 5.6 マニュアルでは 19章から22章)

21章 INFORMATION_SCHEMA の章では、1節が追加され、2節が除去されています。

追加:20.8 The INFORMATION_SCHEMA FILES Table
除外:旧21.30 INFORMATION_SCHEMA Tables for MySQL Cluster
除外:旧21.31 Thread Pool INFORMATION_SCHEMA Tables

22章が新たに追加されたのは機能の日記のとおり。sysスキーマについての章です。
(つまりMySQL 5.6 と比べて、章は、1増1減なので、トータルで26個の章から構成されているところは、結果として変わりません)


こんな感じ。
sysスキーマJSONの、章または節レベルでの情報追加が、やはり MySQL 5.7 の「ウリ」として、マニュアルでも目立っていますね。

MySQLマニュアルのもくじ(節レベル)

1 General Information 
    1.1 About This Manual 
    1.2 Typographical and Syntax Conventions 
    1.3 Overview of the MySQL Database Management System 
    1.4 What Is New in MySQL 5.6 
    1.5 MySQL Information Sources 
    1.6 How to Report Bugs or Problems 
    1.7 MySQL Standards Compliance 
    1.8 Credits 
2 Installing and Upgrading MySQL 
    2.1 General Installation Guidance 
    2.2 Installing MySQL on Unix/Linux Using Generic Binaries 
    2.3 Installing MySQL on Microsoft Windows 
    2.4 Installing MySQL on OS X 
    2.5 Installing MySQL on Linux 
    2.6 Installing MySQL Using Unbreakable Linux Network (ULN) 
    2.7 Installing MySQL on Solaris and OpenSolaris 
    2.8 Installing MySQL on FreeBSD 
    2.9 Installing MySQL from Source 
    2.10 Postinstallation Setup and Testing 
    2.11 Upgrading or Downgrading MySQL 
    2.12 Environment Variables 
    2.13 Perl Installation Notes 
3 Tutorial 
    3.1 Connecting to and Disconnecting from the Server 
    3.2 Entering Queries 
    3.3 Creating and Using a Database 
    3.4 Getting Information About Databases and Tables 
    3.5 Using mysql in Batch Mode 
    3.6 Examples of Common Queries 
    3.7 Using MySQL with Apache 
4 MySQL Programs 
    4.1 Overview of MySQL Programs 
    4.2 Using MySQL Programs 
    4.3 MySQL Server and Server-Startup Programs 
    4.4 MySQL Installation-Related Programs 
    4.5 MySQL Client Programs 
    4.6 MySQL Administrative and Utility Programs 
    4.7 MySQL Program Development Utilities 
    4.8 Miscellaneous Programs 
5 MySQL Server Administration 
    5.1 The MySQL Server 
    5.2 MySQL Server Logs 
    5.3 Running Multiple MySQL Instances on One Machine 
    5.4 Tracing mysqld Using DTrace 
6 Security 
    6.1 General Security Issues 
    6.2 The MySQL Access Privilege System 
    6.3 MySQL User Account Management 
7 Backup and Recovery 
    7.1 Backup and Recovery Types 
    7.2 Database Backup Methods 
    7.3 Example Backup and Recovery Strategy 
    7.4 Using mysqldump for Backups 
    7.5 Point-in-Time (Incremental) Recovery Using the Binary Log 
    7.6 MyISAM Table Maintenance and Crash Recovery 
8 Optimization 
    8.1 Optimization Overview 
    8.2 Optimizing SQL Statements 
    8.3 Optimization and Indexes 
    8.4 Optimizing Database Structure 
    8.5 Optimizing for InnoDB Tables 
    8.6 Optimizing for MyISAM Tables 
    8.7 Optimizing for MEMORY Tables 
    8.8 Understanding the Query Execution Plan 
    8.9 Controlling the Query Optimizer 
    8.10 Buffering and Caching 
    8.11 Optimizing Locking Operations 
    8.12 Optimizing the MySQL Server 
    8.13 Measuring Performance (Benchmarking) 
    8.14 Examining Thread Information 
9 Language Structure 
    9.1 Literal Values 
    9.2 Schema Object Names 
    9.3 Keywords and Reserved Words 
    9.4 User-Defined Variables 
    9.5 Expression Syntax 
    9.6 Comment Syntax 
10 Globalization 
    10.1 Character Set Support 
    10.2 Setting the Error Message Language 
    10.3 Adding a Character Set 
    10.4 Adding a Collation to a Character Set 
    10.5 Character Set Configuration 
    10.6 MySQL Server Time Zone Support 
    10.7 MySQL Server Locale Support 
11 Data Types 
    11.1 Data Type Overview 
    11.2 Numeric Types 
    11.3 Date and Time Types 
    11.4 String Types 
    11.5 Extensions for Spatial Data 
    11.6 Data Type Default Values 
    11.7 Data Type Storage Requirements 
    11.8 Choosing the Right Type for a Column 
    11.9 Using Data Types from Other Database Engines 
12 Functions and Operators 
    12.1 Function and Operator Reference 
    12.2 Type Conversion in Expression Evaluation 
    12.3 Operators 
    12.4 Control Flow Functions 
    12.5 String Functions 
    12.6 Numeric Functions and Operators 
    12.7 Date and Time Functions 
    12.8 What Calendar Is Used By MySQL? 
    12.9 Full-Text Search Functions 
    12.10 Cast Functions and Operators 
    12.11 XML Functions 
    12.12 Bit Functions and Operators 
    12.13 Encryption and Compression Functions 
    12.14 Information Functions 
    12.15 Spatial Analysis Functions 
    12.16 Functions Used with Global Transaction IDs 
    12.17 MySQL Enterprise Encryption Functions 
    12.18 Miscellaneous Functions 
    12.19 Functions and Modifiers for Use with GROUP BY Clauses 
    12.20 Precision Math 
13 SQL Statement Syntax 
    13.1 Data Definition Statements 
    13.2 Data Manipulation Statements 
    13.3 MySQL Transactional and Locking Statements 
    13.4 Replication Statements 
    13.5 SQL Syntax for Prepared Statements 
    13.6 MySQL Compound-Statement Syntax 
    13.7 Database Administration Statements 
    13.8 MySQL Utility Statements 
14 The InnoDB Storage Engine 
    14.1 Introduction to InnoDB 
    14.2 InnoDB Concepts and Architecture 
    14.3 InnoDB Configuration 
    14.4 InnoDB Tablespace Management 
    14.5 InnoDB Table Management 
    14.6 InnoDB Table Compression 
    14.7 InnoDB File-Format Management 
    14.8 InnoDB Row Storage and Row Formats 
    14.9 InnoDB Disk I/O and File Space Management 
    14.10 InnoDB and Online DDL 
    14.11 InnoDB Startup Options and System Variables 
    14.12 InnoDB INFORMATION_SCHEMA Tables 
    14.13 InnoDB Integration with MySQL Performance Schema 
    14.14 InnoDB Monitors 
    14.15 InnoDB Backup and Recovery 
    14.16 InnoDB and MySQL Replication 
    14.17 InnoDB Integration with memcached 
    14.18 InnoDB Troubleshooting 
15 Alternative Storage Engines 
    15.1 Setting the Storage Engine 
    15.2 The MyISAM Storage Engine 
    15.3 The MEMORY Storage Engine 
    15.4 The CSV Storage Engine 
    15.5 The ARCHIVE Storage Engine 
    15.6 The BLACKHOLE Storage Engine 
    15.7 The MERGE Storage Engine 
    15.8 The FEDERATED Storage Engine 
    15.9 The EXAMPLE Storage Engine 
    15.10 Other Storage Engines 
    15.11 Overview of MySQL Storage Engine Architecture 
16 High Availability and Scalability 
    16.1 Using MySQL within an Amazon EC2 Instance 
    16.2 Using ZFS Replication 
    16.3 Using MySQL with memcached 
17 Replication 
    17.1 Replication Configuration 
    17.2 Replication Implementation 
    17.3 Replication Solutions 
    17.4 Replication Notes and Tips 
18 MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4 
    18.1 MySQL Cluster Overview 
    18.2 MySQL Cluster Installation 
    18.3 Configuration of MySQL Cluster 
    18.4 MySQL Cluster Programs 
    18.5 Management of MySQL Cluster 
    18.6 MySQL Cluster Replication 
    18.7 MySQL Cluster Release Notes 
19 Partitioning 
    19.1 Overview of Partitioning in MySQL 
    19.2 Partitioning Types 
    19.3 Partition Management 
    19.4 Partition Pruning 
    19.5 Partition Selection 
    19.6 Restrictions and Limitations on Partitioning 
20 Stored Programs and Views 
    20.1 Defining Stored Programs 
    20.2 Using Stored Routines (Procedures and Functions) 
    20.3 Using Triggers 
    20.4 Using the Event Scheduler 
    20.5 Using Views 
    20.6 Access Control for Stored Programs and Views 
    20.7 Binary Logging of Stored Programs 
21 INFORMATION_SCHEMA Tables 
    21.1 The INFORMATION_SCHEMA CHARACTER_SETS Table 
    21.2 The INFORMATION_SCHEMA COLLATIONS Table 
    21.3 The INFORMATION_SCHEMA COLLATION_CHARACTER_SET_APPLICABILITY Table 
    21.4 The INFORMATION_SCHEMA COLUMNS Table 
    21.5 The INFORMATION_SCHEMA COLUMN_PRIVILEGES Table 
    21.6 The INFORMATION_SCHEMA ENGINES Table 
    21.7 The INFORMATION_SCHEMA EVENTS Table 
    21.8 The INFORMATION_SCHEMA GLOBAL_STATUS and SESSION_STATUS Tables 
    21.9 The INFORMATION_SCHEMA GLOBAL_VARIABLES and SESSION_VARIABLES Tables 
    21.10 The INFORMATION_SCHEMA KEY_COLUMN_USAGE Table 
    21.11 The INFORMATION_SCHEMA OPTIMIZER_TRACE Table 
    21.12 The INFORMATION_SCHEMA PARAMETERS Table 
    21.13 The INFORMATION_SCHEMA PARTITIONS Table 
    21.14 The INFORMATION_SCHEMA PLUGINS Table 
    21.15 The INFORMATION_SCHEMA PROCESSLIST Table 
    21.16 The INFORMATION_SCHEMA PROFILING Table 
    21.17 The INFORMATION_SCHEMA REFERENTIAL_CONSTRAINTS Table 
    21.18 The INFORMATION_SCHEMA ROUTINES Table 
    21.19 The INFORMATION_SCHEMA SCHEMATA Table 
    21.20 The INFORMATION_SCHEMA SCHEMA_PRIVILEGES Table 
    21.21 The INFORMATION_SCHEMA STATISTICS Table 
    21.22 The INFORMATION_SCHEMA TABLES Table 
    21.23 The INFORMATION_SCHEMA TABLESPACES Table 
    21.24 The INFORMATION_SCHEMA TABLE_CONSTRAINTS Table 
    21.25 The INFORMATION_SCHEMA TABLE_PRIVILEGES Table 
    21.26 The INFORMATION_SCHEMA TRIGGERS Table 
    21.27 The INFORMATION_SCHEMA USER_PRIVILEGES Table 
    21.28 The INFORMATION_SCHEMA VIEWS Table 
    21.29 INFORMATION_SCHEMA Tables for InnoDB 
    21.30 INFORMATION_SCHEMA Tables for MySQL Cluster 
    21.31 Thread Pool INFORMATION_SCHEMA Tables 
    21.32 Extensions to SHOW Statements 
22 MySQL Performance Schema 
    22.1 Performance Schema Quick Start 
    22.2 Performance Schema Configuration 
    22.3 Performance Schema Queries 
    22.4 Performance Schema Instrument Naming Conventions 
    22.5 Performance Schema Status Monitoring 
    22.6 Performance Schema Atom and Molecule Events 
    22.7 Performance Schema Statement Digests 
    22.8 Performance Schema General Table Characteristics 
    22.9 Performance Schema Table Descriptions 
    22.10 Performance Schema Option and Variable Reference 
    22.11 Performance Schema Command Options 
    22.12 Performance Schema System Variables 
    22.13 Performance Schema Status Variables 
    22.14 Performance Schema and Plugins 
    22.15 Using the Performance Schema to Diagnose Problems 
23 Connectors and APIs 
    23.1 MySQL Connector/ODBC 
    23.2 MySQL Connector/Net 
    23.3 MySQL Connector/J 
    23.4 MySQL Connector/C++ 
    23.5 MySQL Connector/C 
    23.6 MySQL Connector/Python 
    23.7 libmysqld, the Embedded MySQL Server Library 
    23.8 MySQL C API 
    23.9 MySQL PHP API 
    23.10 MySQL Perl API 
    23.11 MySQL Python API 
    23.12 MySQL Ruby APIs 
    23.13 MySQL Tcl API 
    23.14 MySQL Eiffel Wrapper 
24 Extending MySQL 
    24.1 MySQL Internals 
    24.2 The MySQL Plugin API 
    24.3 MySQL Services for Plugins 
    24.4 Adding New Functions to MySQL 
    24.5 Debugging and Porting MySQL 
25 MySQL Enterprise Edition 
    25.1 MySQL Enterprise Monitor Overview 
    25.2 MySQL Enterprise Backup Overview 
    25.3 MySQL Enterprise Security Overview 
    25.4 MySQL Enterprise Encryption Overview 
    25.5 MySQL Enterprise Audit Overview 
    25.6 MySQL Enterprise Firewall Overview 
    25.7 MySQL Enterprise Thread Pool Overview 
26 MySQL Workbench 

MySQLマニュアル、5.6と5.7の違い(Level 1)

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの21日目ぶんです。


 MySQLのマニュアル。全26章から成りますが、実は バージョン5.6とバージョン5.7で、若干構成が変わっています。
まず今日は、章立てのレベル(レベル1)での違いを紹介します。


 1章から17章までは、どちらのバージョンも同じ。
バージョン5.6では 18章として存在していた「MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4 」が、バージョン 5.7 では別ドキュメントへと移動したために、なくなりました。

 以降しばらく、章番号がバージョン 5.6 と 5.7 でずれますので、人とお話する際に章の番号で言うと伝わらないことがあるのでご注意を。
 Partitioning (5.6では19章、5.7では18章)
 Stored Programs and Views (5.6では20章、5.7では19章)
のようになります。


 MySQL 5.7 のマニュアルでは、「22章 MySQL sys Schema」が追加されています。19日目の日記で紹介したものです。

 以降の部分は、両バージョンで同じです。

 まとめると、MySQL 5.6 から MySQL 5.7 へのマニュアルの変化は、
・旧18章(NDBクラスタ)が除外された
・新22章(sysスキーマ)が追加された
・それにともない、18-22章のあいだで、両バージョンに章番号のずれが発生している

 となります。


明日は Level 2 まで見ての差異を紹介したいと思います。


MySQL 5.7 マニュアルの構成(章単位)

1 General Information
2 Installing and Upgrading MySQL
3 Tutorial
4 MySQL Programs
5 MySQL Server Administration
6 Security
7 Backup and Recovery
8 Optimization
9 Language Structure
10 Globalization
11 Data Types
12 Functions and Operators
13 SQL Statement Syntax
14 The InnoDB Storage Engine
15 Alternative Storage Engines
16 High Availability and Scalability
17 Replication
18 MySQL Cluster NDB 7.3 and MySQL Cluster NDB 7.4
19 Partitioning
20 Stored Programs and Views
21 INFORMATION_SCHEMA Tables
22 MySQL Performance Schema
23 Connectors and APIs
24 Extending MySQL
25 MySQL Enterprise Edition
26 MySQL Workbench

MySQLマニュアルでのバージョン番号の説明とか

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの20日目です.


 昨日の日記で、sysスキーマ内の VERSION_* ファンクションを見ながら、バージョン番号の呼び方について若干の混乱をしました。というのも、私はセミナーなどで常に、「MySQLのメジャーバージョンは、5.7 とか 5.5 とか、5.0 とか、3.23 とかのように2つの数字の組み合わせであらわされます。4.0と4.1はまったくの別物であり、5.6と5.7もまったく別物です。なので、"バージョン 4から使ってます!" みたいな発言をすると、この人MySQL知らないんだな、と思われるので、"MySQL 4.1から使っています" のように、正しくメジャーバージョンを言えるようになりましょう」という内容のことを申し上げていました。

 言っている内容自体には大きな誤りはないのですが、ここでテーマとしているのは「メジャーバージョン」という言葉です。これは、MySQL 5.7 で導入された sys スキーマの VERSION_MAJOR(), VERSION_MINOR() ファンクションの表現と異なっているからです。昨日の日記で書いたとおり、MySQL 5.7.10 に於いては、

  メジャーバージョン: 5
  マイナーバージョン: 7
  パッチバージョン: 10

と呼ぶのが正しいということになりそうです。


 ということで、実はマニュアルにもバージョン番号のルールについての説明が(昔から)あります(yoku0825さんありがとうございます)。今日はその部分を眺めてみることにしましょう。

Chapter 2 Installing and Upgrading MySQL の中の
2.1 General Installation Guidance の中に
MySQL :: MySQL 5.7 Reference Manual :: 2.1.1 Which MySQL Version and Distribution to Install
があります。

 バージョンをあらわす数字についての説明部分を抜き書きします:

  • The first number (5) is the major version and describes the file format. All MySQL 5 releases have the same file format.
  • The second number (6) is the release level. Taken together, the major version and release level constitute the release series number.
  • The third number (1) is the version number within the release series. This is incremented for each new release. Usually you want the latest version for the series you have chosen.

要約すると 5.7.10 の場合、
 メジャーバージョン: 5 の部分
 リリースレベル: 7 の部分。 メジャーバージョンとリリースレベルを合わせて、シリーズナンバーと呼ぶ。
 リリースシリーズ内でのバージョンナンバー: 10 の部分。

とのことです。sysスキーマ内の用語とも異なりますね。
ちなみにマニュアルのこの記述、MySQL 4.1 シリーズの時にはすでに同じ用語での記述になっていました。


MySQL 4.1マニュアルより:

  • The first number (4) is the major version and also describes the file format. All version 4 releases

have the same file format.

  • The second number (1) is the release level. Taken together, the major version and release level

constitute the release series number.

  • The third number (2) is the version number within the release series. This is incremented for

each new release. Usually you want the latest version for the series you have chosen.


一緒ですね。


 そんなわけで、今後は「 "MySQL 5.7" というのは "シリーズ" (not メジャーバージョン)」ということで、発言に気をつけて参りたいと思います。普通に「バージョン 5.7」と言うことが大半でしょうけどね。



 ちなみに、マニュアルでのバージョンに関する記述。 バージョン番号の後ろにつく -rc や -m14 などの部分についても説明されています。バージョン 5.6シリーズでも記述はほとんど変わっていないので、日本語マニュアルを参照するのも良いかと思います。
MySQL :: MySQL 5.6 リファレンスマニュアル :: 2.1.2 インストールする MySQL のバージョンと配布の選択

MySQLの新しい「sys」スキーマ

この記事は、2015年「MySQLマニュアルを読む」アドベントカレンダーの19日目です.


 MySQL 5.7.7 からは、新たに「sys」という名前のスキーマが追加されました。

MySQL :: MySQL 5.7 Reference Manual :: 22 MySQL sys Schema

 これは大雑把に言うと、MySQLの開発や管理をする上で便利な機能を集めたものです。
もう少し具体的には、便利なストアドプロシージャ(ストアドファンクション)やVIEWなどを集めたものだと考えて良いかと思います。

22.1 Prerequisites for Using the sys Schema
22.2 Using the sys Schema
22.3 sys Schema Progress Reporting
22.4 sys Schema Object Reference
    22.4.1 sys Schema Object Index
    22.4.2 sys Schema Tables and Triggers
    22.4.3 sys Schema Views
    22.4.4 sys Schema Stored Procedures
    22.4.5 sys Schema Stored Functions

 まず VIEW について。
sysスキーマには、100個を越えるVIEWが用意されています(似た機能の別名的なものもあるので実際は60個くらいと考えてよさそう)。私は最近あまり、MySQLを使った大きな運用に関わっていないのでピンと来ないのですが、様々なサーバの状態を見ることができそうです。プロセス状態、InnoDBのバッファ状態、ホストの状態、セッションやメモリの状態などなど。INFORMATION_SCHAMA や PERFORMANCE_SCHEMA から状態を取得します。
 多くのVIEWがあるので、運用や開発に使ってみようという方は、マニュアルから、それっぽい名前のものに当たりをつけて試してみると良いでしょう。 
MySQL :: MySQL 5.7 Reference Manual :: 22.4.3 sys Schema Views

 なお、マニュアルを眺めた方は気づかれたかと思いますが、同じような名前で、先頭に x$ がつくものとつかないものがあります。
これは、
 先頭に x$ がつかないもの: 人間に見やすいように出力(主に ms(ミリ秒)やbyte単位などで出力)
 先頭に x$ がつくもの: より正確な値を出力
という違いがあります。
いくつかの VIEW を眺めてみたところ、たとえば秒単位で出力するものについて、前者は 0.01s まで、後者は ns(ナノ秒)までをあらわす数字が出力されていました。


 次に、Stored Procedure および Stored Function について。
値を返さないものがプロシジャで、値を返すものがファンクションです。
sysスキーマにおいては、CALLでコールして状態を変化させたり設定変更したりするのがプロシジャ、
なんらかの取得結果や演算結果の値を取得するのがファンクション、となります。

 プロシジャについては何をどう変更するのか、今回は追いませんので、興味あるかたは以下マニュアルにて確認ください。MySQL5.7.10の時点では、26個ほどのプロシジャが用意されているようです。
MySQL :: MySQL 5.7 Reference Manual :: 22.4.4 sys Schema Stored Procedures

 ファンクションについて、21個ほどのファンクションが用意されているようです。まず、コンマ区切りのリストに項目を追加したり、逆にリストから項目を除いたりするファンクションや、x$ビューで得られた細かい数字を見やすい形に変換してくれるファンクションなどが目につきます。


sysスキーマのファンクション一覧:From MySQL :: MySQL 5.7 Reference Manual :: 22.4.5 sys Schema Stored Functions

単位変換:
format_bytes()
format_path()
format_statement()
format_time()

コンマ文字列加工:
list_add()
list_drop()

パス名文字列からの抽出:
extract_schema_from_file_name()
extract_table_from_file_name()

パフォーマンススキーマからの情報取得系:
ps_is_account_enabled()
ps_is_consumer_enabled()
ps_is_instrument_default_enabled()
ps_is_instrument_default_timed()
ps_is_thread_instrumented()
ps_thread_account()
ps_thread_id()
ps_thread_stack()
ps_thread_trx_info()

その他:
sys_get_config(config_name,default_return_value) <-- sys_configの値を取得
version_major()
version_minor()
version_patch()


 さて、ここで驚くべきことに気づきました。現在MySQLの最新バージョンは、バージョン 5.7。古くからのMySQLユーザの方は、MySQL 4.0 から 4.1 への大きな変更での混乱を覚えていることでしょう。
そう、MySQLに於いては「5.7」「4.1」などというのがメジャーバージョンであり、私も各地のセミナーでドヤ顔でそのように説明してきました。
 が、、、この sys スキーマには version_major() など、version_*()な関数が3つ、目につきますね。試してみましょう*1

mysql> SELECT VERSION(), VERSION_MAJOR(), VERSION_MINOR(), VERSION_PATCH();
+-----------+-----------------+-----------------+-----------------+
| VERSION() | VERSION_MAJOR() | VERSION_MINOR() | VERSION_PATCH() |
+-----------+-----------------+-----------------+-----------------+
| 5.7.10    |               5 |               7 |              10 |
+-----------+-----------------+-----------------+-----------------+


 なんということでしょう!!!
sysスキーマによると、いま使っているMySQLのメジャーバージョンは 5 です! もう一度書きます。「MySQLのメジャーバージョンが、5!!!」。
いやぁ、参った。。これはバグ報告すべきでしょうか(笑)。MAJOR_UPPER、MAJOR_LOWER とか、かなぁ、、、適切な名前を考えるとしたら。



 と書いてからふと思い出したけど、MySQLソースコードの中では昔からこのような名付けがされていたかも。(日々、ソースコードリポジトリから変更を取得してきて、ここの設定値が変更されていたら「バージョンがあがるぞ!」と自分に通知するようなスクリプトを書いていた記憶が・・・)

VERSION:

MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=7
MYSQL_VERSION_PATCH=10
MYSQL_VERSION_EXTRA=

 いやぁ、、、それでも、、、、「"5.7" というカタマリで "メジャーバージョン" です!」と言い切ってしまってきたからなぁ、、、参った。。これからは「メジャーバージョンは 5 で、マイナーバージョンが 7 です。しかし、MySQLではマイナーバージョンまでがメジャーなバージョンです!」とか説明するか。。意味不明。



追記:
 twitter で yoku0825 さんに教えていただきました。


 「シリーズ」または「リリース系列」と呼べばいいんですね。「メジャーバージョンは 5.7」という言い方は、今後使わないことにします。「5.7シリーズ」「5.7系列」「リリース系列が 5.7」などの言い回し、まだちょっと慣れないけど、慣れていくよう、浸透するよう、努力したいと思います。 *2



追追記:翌日の日記に、(MySQLマニュアル内での)バージョン番号に関する説明について書きました。
sakaik.hateblo.jp

*1:VERSIONというのはsysスキーマのファンクションではなく

*2:もうすでに「マニュアル」の話、どうでもよくなってるw