Skip to content

Commit ad5da7c

Browse files
staabmclxmstaab
andauthored
added more general mysql optimization tips (#384)
Co-authored-by: Markus Staab <[email protected]>
1 parent 37a9500 commit ad5da7c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Rules/QueryPlanAnalyzerRule.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ private function analyze(CallLike $callLike, Scope $scope): array
131131
$table
132132
))
133133
->line($callLike->getLine())
134+
->tip('see Mysql Docs https://dev.mysql.com/doc/refman/8.0/en/select-optimization.html')
134135
->build();
135136
}
136137
} else {
@@ -152,6 +153,7 @@ private function analyze(CallLike $callLike, Scope $scope): array
152153
$table
153154
))
154155
->line($callLike->getLine())
156+
->tip('see Mysql Docs https://dev.mysql.com/doc/refman/8.0/en/select-optimization.html')
155157
->build();
156158
}
157159
}

tests/rules/QueryPlanAnalyzerRuleTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,23 @@ public function testNotUsingIndex(): void
5454
$this->numberOfRowsNotRequiringIndex = 2;
5555

5656
$proposal = "\n\nConsider optimizing the query.\nIn some cases this is not a problem and this error should be ignored.";
57+
$tip = 'see Mysql Docs https://dev.mysql.com/doc/refman/8.0/en/select-optimization.html';
58+
5759
$this->analyse([__DIR__.'/data/query-plan-analyzer.php'], [
5860
[
5961
"Query is not using an index on table 'ada'.".$proposal,
6062
12,
63+
$tip,
6164
],
6265
[
6366
"Query is not using an index on table 'ada'.".$proposal,
6467
17,
68+
$tip,
6569
],
6670
[
6771
"Query is not using an index on table 'ada'.".$proposal,
6872
22,
73+
$tip,
6974
],
7075
]);
7176
}

0 commit comments

Comments
 (0)