/mysql-xplain-xplain

:mouse: Explain Explainer for MySQL Queries.

Primary LanguagePHPMIT LicenseMIT

mysql-xplain-xplain

Build Status Bitdeli Badge

Explain Explainer for MySQL Queries. Something like an upgraded EXPLAIN command for browser. Highlights and explains MySQL queries. It gives also hints and links. Hope it will help. More info here : http://mxx.mnstrl.org/

Getting started

  • Download last release archive and unzip it into your webroot folder or install via composer : composer create-project rap2h/mysql-explain-explain --prefer-dist
  • Launch your web server, goto http://localhost/xplain or something like that
  • Start typing your queries

Console

Setup connection

In confg/db.php

<?php return array(
    'host' => 'localhost',
    'user' => 'root',
    'pass' => 'pass',
    'base' => 'my_database'
);

Or

php bin/explain --host=localhost --user=root --pass=pass --base=my_database

Query from string

php bin/explain "select * from books where id = 1"

Query from SQL file

php bin/explain ./query_data.sql

Output danger queries

php bin/explain ./query_data.sql --danger

Output warning queries

php bin/explain ./query_data.sql --warning

Set SQL mode

php bin/explain ./query_data.sql --sql-mode=ANSI

Why?

MySQL EXPLAIN command is sometimes hard to understand. We try to make it more readable with some improvements. In a web browser.

Contributors

  • tazorax
  • rap2hpoutre
  • slythas
  • vincent-aubert