A tool to profile mysql queries in php env.

Related tags

mysql php profiler


This tool helps you to quickly profile a mysql query in a PHP 7.4+ environnement. You can also compare 2 queries.


This image shows the results when comparing 2 ip search queries ((A) BETWEEN + index vs (B) INTERSECTS + SPACIAL index):

  • left: query cost (SHOW STATUS...)
  • right: query plan (SHOW PROFILE...)
  • bottom: optimizer information (EXPLAIN...)

This is a standalone one file php script. Not dependency (vanilla js, css and standard php modules only).

Why use it?

It helps you to:

  • find mysql configuration issues
  • improve your indexes
  • improve your queries
  • spot mysql limitations


  • Display the following reports:
    • query cost (SHOW STATUS...)
    • query plan (SHOW PROFILE...)
    • optimizer information (EXPLAIN...)
  • Compare 2 queries
  • Highlight the better values
  • Link to the mysql doc for status metric
  • Dark and light modes (prefers-color-scheme)
  • IP filtering


Use it only in DEV and control who can access it!

  1. Copy the file in a secure location (with .htaccess, etc.)
  2. Create a mysql user with profiling privileges.
  3. Configure the tool (user, password, ip allow list, etc.)

Usage within Docker

The following will create a PHP 7.4 container with the mysql query profiler and also a mariadb 10.4 container

docker-compose up -d

Open http://localhost/mysql_query_profiler.php in your web browser

To stop, run docker compose down


You may want to profile the queries generated by your application by clicking on a link from your web pages.

  1. In your main configuration file, add a constant that will allow you to turn on/off the query displaying. For example:
define('MQP_PROFILE_QUERIES', true);
  1. Copy-paste-adapt this code in a method where all your queries go through:
  echo '<div style="border:1px solid #ff9966;padding:5px;margin:5px">';
  echo '<a href="/mysql_query_profiler.php?query=' . urlencode($query) . '" target="mqp">';
  echo htmlspecialchars($query);
  echo '</a>';
  echo '</div>';
  • Dockerized things

    Dockerized things

    Added mysql_query_profiler to a docker container running PHP 7.4 Added docker_compose to run the PHP and a separate MariaDB container for testing

    opened by gordonmurray 0
  • v1.0.0(Apr 29, 2021)


    • Display the following reports (query cost (SHOW STATUS...), query plan (SHOW PROFILE...), optimizer information (EXPLAIN...))
    • Compare 2 queries
    • Highlight the better values
    • Link to the mysql doc for status metric
    • Dark and light modes (prefers-color-scheme)
    • IP filtering
    • Font-size configuration
    • Charset configuration
    Source code(tar.gz)
    Source code(zip)
Runs artisan command in web application

Laravel Terminal Installation composer require recca0120/terminal --dev OR Add Presenter to your composer.json file: "require-dev": { "recca0120/t

Recca Tsai 688 Jun 11, 2021
Clockwork - php dev tools in your browser - server-side component

Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including requ

its 3.6k Jun 13, 2021
PHP APM (Alternative PHP Monitor)

APM (Alternative PHP Monitor) APM (Alternative PHP Monitor) is a monitoring extension enabling native Application Performance Management (APM) for PHP

Patrick Allaert 305 May 25, 2021
😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

Tracy - PHP debugger Introduction Tracy library is a useful helper for everyday PHP programmers. It helps you to: quickly detect and correct errors lo

Nette Foundation 1.4k Jun 17, 2021
An artisan command to tail your application logs

Easily tail your logs This package offers an artisan command to tail the application log. It supports daily and single logs on your local machine. To

Spatie 598 Jun 8, 2021
Laravel Debugbar (Integrates PHP Debug Bar)

Laravel Debugbar This is a package to integrate PHP Debug Bar with Laravel. It includes a ServiceProvider to register the debugbar and attach it to th

Barry vd. Heuvel 12.8k Jun 21, 2021
Xdebug — Step Debugger and Debugging Aid for PHP

Xdebug Xdebug is a debugging tool for PHP. It provides step-debugging and a whole range of development aids, such as stack traces, a code profiler, fe

Xdebug 2.4k Jun 19, 2021
Low-overhead sampling profiler for PHP 7+

phpspy phpspy is a low-overhead sampling profiler for PHP. For now, it works with Linux 3.2+ x86_64 non-ZTS PHP 7.0+ with CLI, Apache, and FPM SAPIs.

Adam 1.1k Jun 10, 2021
A Laravel Package to integrate Nette Tracy Debugger

Nette Tracy for Laravel 5 Better Laravel Exception Handler Features Visualization of errors and exceptions Debugger Bar (ajax support @v1.5.6) Excepti

Recca Tsai 385 May 25, 2021
An elegant debug assistant for the Laravel framework.

Introduction Laravel Telescope is an elegant debug assistant for the Laravel framework. Telescope provides insight into the requests coming into your

The Laravel Framework 4k Jun 17, 2021
PHP Debug Console

PHP Console A web console to try your PHP code into Creating a test file or using php's interactive mode can be a bit cumbersome to try random php sni

Jordi Boggiano 512 May 24, 2021
A mail driver to quickly preview mail

A mail driver to quickly preview mail This package can display a small overlay whenever a mail is sent. The overlay contains a link to the mail that w

Spatie 873 Jun 9, 2021
Test your routes without hassle

Laravel Api Tester Live demo Try it out: laravel-api-tester.asva.by Docs Those are short and easy to read. Take a look. Interface FAQ Installation Req

Yauheni Prakopchyk 334 May 11, 2021
Kint - a powerful and modern PHP debugging tool.

Kint - debugging helper for PHP developers What am I looking at? At first glance Kint is just a pretty replacement for var_dump(), print_r() and debug

null 2.5k Jun 15, 2021