By its own reckoning, MySQL Database Server is “the world’s most popular open source database.” Searches are swift, and the architecture makes it easy to customize. The server and storage engine are separate, which “makes it possible to run with strict transaction control or with ultra-fast transactionless disk access, whichever is most appropriate for the situation.” And being open source, a GPL-licensed version is available for free online. From its initial adoption by Linux users, the database server has begun to make inroads on the marketplace dominated by Oracle and MS SQL. MySQL AB averages around 35,000 downloads of their software every day.
You get the program free, true—but manuals and tutorials come at a charge, as does the enterprise-level product. Even with the utilities that come bundled with MySQL, though, it’s hard to keep all of its possibilities in mind. That’s where Russell Dyer comes in. With MySQL in a Nutshell, Dyer has provided the perfect desk reference for this powerful DB engine.
This is not a book to learn database management from, nor is it a tutorial for building MySQL applications. There are plenty of helpful tutorials for those purposes, after all. The need that Dyer’s book answers is the midnight-oil-burning, “how the heck do I analyze tables again? And are they delineated with commas or semicolons?” kind of question. You know the ones I mean; if you answer right, you get to go home and sleep with your spouse for a few hours—but answer wrong, and you’ll still be sweating over the database when the day shift arrives.
ANALYZE [LOCAL|NO_WRITE_TO_BINLOG] TABLE table[, ...]
Use this statement to analyze and store the key distribution of a table. It works on BDB, InnoDB,and MyISAM tables. Unless the NO_WRITE_TO_BINLOG option is given, the statement is written to the binary log file. The LOCAL option is synonymous.
ANALYZE TABLE workreq;
|Table |Op |Msq_type|Msg_text|
|workrequests.workreq|analyze|status |OK |
The message type results can be status, error, info or warning. If the table hasn’t changed since it was last analyzed, the message text will read, “Table is already up to date” and the table won’t be analyzed. This statement is equivalent to using myisamchk -a at the command line for MyISAM tables.
There is a quick list of installation instructions for various operating systems (a couple of pages each), followed by a brief (15-page) introduction to MySQL, then Dyer launches into the command syntax and purpose of the multitude of MySQL options. Entries are separated into chapters by type:
- SQL Statements
- String Functions
- Date and Time Functions
- Aggregate and Mathematical Functions
- Flow Control Functions
- Miscellaneous Functions
- MySQL Server and Clients
- Command-Line Utilities
- Perl API
- PHP API
- C API
As you can see from the list, the entries cover everything that might be a challenge in managing or using MySQL. But just to make absolutely sure, Dyer includes several appendices that define datatypes, operators and environment variables. Tables scattered throughout the book list the nuances of option switches and parameters, essential for statements and functions with more than one or two choices.