tpetry/laravel-mysql-explain
소개
Get Visual MySQL EXPLAIN plans with Laravel that are understandable for humans
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalLaravel MySQL Visual Explains
MySQL Query optimization with the EXPLAIN command is unnecessarily complicated: The output contains a lot of cryptic information that is incomprehensible or entirely misleading.
This Laravel package collects many query metrics that will be sent to mysqlexplain.com and transformed to be much easier to understand.
Installation
You can install the package via composer:
composer require tpetry/laravel-mysql-explain
Usage
Query Builder
Three new methods have been added to the query builder for very easy submission of query plans:
| Type | Action |
|---|---|
visualExplain |
returns URL to processed EXPLAIN output |
dumpVisualExplain |
dumps URL to processed EXPLAIN output and continue normal execution |
ddVisualExplain |
dumps URL to processed EXPLAIN output and stops execution |
explainForHumans (deprecated) |
returns URL to processed EXPLAIN output |
dumpExplainForHumans (deprecated) |
dumps URL to processed EXPLAIN output and continue normal execution |
ddExplainForHumans (deprecated) |
dumps URL to processed EXPLAIN output and stops execution |
// $url will be e.g. https://mysqlexplain.com/explain/01j2gcrbsjet9r8rav114vgfsy
$url = Film::where('description', 'like', '%astronaut%')
->visualExplain();
// URL to EXPLAIN will be printed to screen
$users = Film::where('description', 'like', '%astronaut%')
->dumpVisualExplain()
->get();
// URL to EXPLAIN will be printed to screen & execution is stopped
Film::where('description', 'like', '%astronaut%')
->ddVisualExplain();
Raw Queries
In some cases you are executing raw SQL queries and don't use the query builder. You can use the MysqlExplain facade to get the EXPLAIN url for them:
use Tpetry\LaravelMysqlExplain\Facades\MysqlExplain;
// $url will be e.g. https://mysqlexplain.com/explain/01j2gctgtheyva7a7mhpv8azje
$url = MysqlExplain::submitQuery(
DB::connection('mysql'),
'SELECT * FROM actor WHERE first_name = ?',
['PENEL\'OPE'],
);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
관련 프로젝트 살펴보기
불러오는 중…