A beginners guide to MariaDB


Published on

MariaDB started life as a database to host the Maria storage engine in 2009. Not long after its inception, the MySQL community went through yet another change in ownership, and it was deemed that MariaDB will be a complete database branch developed to extend MySQL, but with constant merging of upstream changes.

The goal of the MariaDB project is to ensure that everyone is part of the community, including employees of the major steering companies. MariaDB also features enhanced features, some of which are common with the Percona Performance Server. Most importantly, MariaDB is a drop-in replacement and is completely backward compatible with MySQL. In 2010, MariaDB released 5.1 in February, and 5.2 in November – two major releases in a span of one calendar year is a feat that was achieved!

DBAs and developers alike will gain an introduction to MariaDB, what is different with MySQL, how to make use of the feature enhancements, and more.

Published in: Technology

A beginners guide to MariaDB

  1. 1. A Beginner’s Guide to MariaDB Colin Charles, Monty Program Ab colin@montyprogram.com http://montyprogram.com / http://mariadb.org/ http://bytebot.net/blog / @bytebot on TwitterO’Reilly MySQL Conference & Expo - 12 April 2011
  2. 2. Aims• Give you an update of what we’ve done in the past year (plus since project inception)• Discuss the broader MySQL ecosystem
  3. 3. What is it?• A branch of MySQL with more features?• A branch of MySQL with better features?• A fork?
  4. 4. MariaDB is...• Community Developed• Feature Enhanced• Backward Compatible
  5. 5. Who’s behind it?• MySQL (database) owned by MySQL AB (company)• Monty Program is just a sponsor of MariaDB• MariaDB: Open Database Alliance, Percona, PrimeBase, Open Query, etc.
  6. 6. When did this begin?• Sun buys MySQL AB in January 2008• Oracle proposes acquisition of Sun Microsystems in April 2009• Monty decides that beyond the engine (Febuary 2009), focus on MariaDB, a complete database solution
  7. 7. Why MariaDB?• MySQL - an open source product or project?• MariaDB is an open source project
  8. 8. Aims of MariaDB• 100% compatible, drop-in replacement to MySQL• Stable (bug-free) releases• GPLv2
  9. 9. Compatibility with MySQL• There is no NDB cluster • Tools are similar (some storage engine additional tools for Aria, PBXT)• Client libraries, client- server protocol, SQL • XtraDB enabled by default; dialect, replication master- InnoDB and InnoDB plugin slave all similar are included, but not enabled by default• Data files are supported as long as its similar between • http://kb.askmonty.org/v/ versions mariadb-versus-mysql- compatibility
  10. 10. What’s in MariaDB 5.1• Released February 2010 • Croatian collations• Create external • Numerous bug fixes buildsystem using Buildbot + VMs for test • Test cases and coverage +builds improvements• Release filled with • Removal of mutexes storage engines • Compiler warnings gone! • XtraDB, PBXT, FederatedX, (M)Aria
  11. 11. What’s in MariaDB 5.1• Percona XtraDB • See InnoDB & XtraDB (ENGINE=InnoDB) Architecture & Performance • enhanced InnoDB Optimization slides from Peter Zaitsev at tutorial designed to better scale on modern on Monday hardware; backward compatible, scale • http:// better on many www.percona.com/docs/ cores, use memory wiki/percona- more efficiently xtradb:start
  12. 12. What’s in MariaDB 5.1• PrimeBase PBXT • Write once w/log-based storage; write data to • Transactional, foreign DB, without first writing in transaction log keys, ACID, MVCC (read w/o locking) • http://kb.askmonty.org/v/ • Row-level locking during about-pbxt (SELECT FOR) UPDATE • Wednesday, 04/13/2011 - • Rollback transactions, Ballroom D - 10.50am - Update on the PBXT recovery after restart very fast (identifies Storage Engine by Paul garbage making undo McCullagh unnecessary)
  13. 13. What’s in MariaDB 5.1• Extended statistics for slow query log • Query highly normalised data, it is sometimes possible to • based on microslow from resolve a query without Percona http://kb.askmonty.org/ accessing some tables the v/slow-query-log-extended- query refers to e.g. http:// statistics kb.askmonty.org/v/what-is- table-elimination• PROCESSLIST with microsecond precision • Pool of threads (MySQL 6 backport) • TIME_MS in INFORMATION_SCHEMA.PR • Use a limited set of threads to OCESSLIST http:// handle all queries vs one- kb.askmonty.org/v/time_ms- thread-per-connection http:// column-in- kb.askmonty.org/v/pool-of- information_schemaprocesslist threads• Table elimination
  14. 14. What’s in MariaDB 5.2• Released November 2010 • Use socket_peercred - if already logged in via Unix credentials,• MariaDB 5.2.5 (MariaDB 5.1.55 - MariaDB will trust it changes up to MySQL 5.1.55) • http://kb.askmonty.org/v/• Pluggable authentication development-pluggable- authentication • authentication of users handled by plugins • User Statistics (userstatsv2) • mysql_native_password (20 byte) • Percona, Google, Weldon Whipple. and mysql_old_password (8 byte) Understand server activity better, included by default identify database loads http:// kb.askmonty.org/v/user-statistics • CREATE USER foo IDENTIFIED VIA mysql_native_password USING ‘pass’; == CREATE user foo IDENTIFIED BY PASSWORD ‘pass’;
  15. 15. What’s in MariaDB 5.2• Virtual columns • New storage engines: OQENGINE, SphinxSE • PERSISTENT (stored - default) & VIRTUAL (generated-only) • INFORMATION_SCHEMA.PL UGINS now has • http://kb.askmonty.org/v/virtual- PLUGIN_MATURITY & PLUGIN_AUTH_VERSION columns columns• Segmented MyISAM keycache • CREATE TABLE can be extended • mitigates thread contention for via storage engine API key cache lock, with notable 250% performance • Add additional attributes per improvements http:// index, field or table kb.askmonty.org/v/segmented- key-cache • http://kb.askmonty.org/v/ extending-create-table
  16. 16. How open is MariaDB?• Mailing lists: Launchpad • http://launchpad.net/ maria • maria- developers@lists.laun • Bugs database: chpad.net • https:// • maria- bugs.launchpad.net/ discuss@lists.launchp maria/ ad.net • #maria on FreeNode• Code hosting: IRC Launchpad
  17. 17. Worklog• Funding (bounties)• Votes• http://askmonty.org/ worklog/
  18. 18. Knowledgebase• http://kb.askmonty.org/
  19. 19. Deployments, deployments, deployments“MariaDB had the same bugs that we ran into withMySQL. However the big difference was that whenwe reported these bugs, they were quickly resolvedwithin 48 hours!” -- Dreas van Donselaar, ChiefTechnology Officer, SpamExpertsB.V. after migrating over 300 servers from MySQL5.0 to MariaDB 5.1. “Migrating from MySQL 5.1 to MariaDB 5.2 was as simple as removing MySQL RPMs and installing the MariaDB packages, then running mysql_upgrade.” - Panayot Belchev, proprietor, Host Bulgaria on providing MariaDB to over 7,000 of their web hosting customers.
  20. 20. Getting MariaDB• http://mariadb.org/ is the site + downloads• Get it via OpenSUSE build service• Its in Gentoo, FreeBSD• http://kb.askmonty.org/v/distributions-which-include- mariadb
  21. 21. The future?• There is no “one” tree • Tonnes of optimiser features • MySQL, Percona Performance • index condition pushdown, Server, MariaDB multi-range-read (MRR) table access (with keys & row ID• GIS sorting), block nested loop for outer joins, batched key• HandlerSocket access, classic hash join, numerous subquery• Merging takes time optimisations (possible materialisation for non-• New config files? correleated subqueries), merged derived tables, index• Row based replication improvements merge enhancements• Group commit • dynamic columns support
  22. 22. What else do we need?• InnoDB focus• Replication focus• More benchmarks • http://kb.askmonty.org/v/benchmarks• Spreading the good word
  23. 23. Your roadmap• (past) What are the new optimiser • Dynamic Columns - 3.05pm - features and how can I benefit from 13/04/2011 - Ballroom G them - Sergey Petrunya - Ballroom G - 11.55am - 12/04/2011 • OQGRAPH Dealing with graphs and hierarchies in plain SQL -• (past) Plugin development tutorial Antony Curtis - 10.50am by Sergei Golubchik 14/04/2011 - Ballroom D• State of MariaDB keynote - Michael • A BoF on Wednesday evening to Widenius - 9am - 13/04/2011 plan MariaDB future features• Group commit and related • http://kb.askmonty.org/v/plans- enhancements in the MariaDB for-56 binary log - 2pm - 13/04/2011 - Ballroom H
  24. 24. Plugins & Storage Engine Summit• Interested in plugins and storage engines for MySQL/MariaDB/Drizzle?• Be at the summit! • April 15 2011, 10am-4pm, The Facebook Campus • Sign up here: http://kb.askmonty.org/v/ storage-engine-summit-2011
  25. 25. Booth 411• Expo Hall• Auction for a t-shirt (signed) + dinner with Monty - proceeds go to Japan
  26. 26. Q&A? email: colin@montyprogram.comhttp://montyprogram.com/ | http://mariadb.org/twitter: @bytebot / url: http://bytebot.net/blog/