Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/Database/Advisor.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class Advisor {
'Aborted_connects',
'Thread_cache_hit_rate',
'Slow_query_ratio',
'Select_full_join',
'Sort_merge_passes',
'Created_tmp_disk_tables',
'Innodb_buffer_pool_hit_rate',
Expand All @@ -61,7 +60,6 @@ class Advisor {
'Slow_query_rate',
'Sort_rows',
'Sort_merge_passes_rate',
'Join_without_index_rate',
'Handler_read_first_rate',
'Handler_read_rnd_rate',
'Handler_read_rnd_next_rate',
Expand Down
29 changes: 0 additions & 29 deletions lib/Database/RuleSet/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,6 @@ private function build(): array {
requires: ['Slow_queries', 'Questions'],
);

$rules[] = new Rule(
id: 'Select_full_join',
name: 'Joins without indexes',
category: 'Performance',
severity: Rule::SEVERITY_WARNING,
formula: 'Select_full_join / Questions * 100',
test: 'value > 0.05',
issue: 'Some joins are scanning entire tables because no usable index exists on the join column.',
recommendation: 'Identify the offending queries (set log_queries_not_using_indexes) and add the missing indexes.',
justification: '%s%% of queries did a full join without an index.',
justificationFormula: 'value',
requires: ['Select_full_join', 'Questions'],
);

$rules[] = new Rule(
id: 'Sort_merge_passes',
name: 'Sort buffer passes',
Expand Down Expand Up @@ -488,21 +474,6 @@ private function build(): array {
);

// Performance / joins + scans (rate-based companions to existing absolute checks)
$rules[] = new Rule(
// upstream id: "Rate of joins without indexes"
id: 'Join_without_index_rate',
name: 'Join-without-index rate',
category: 'Performance',
severity: Rule::SEVERITY_NOTICE,
formula: '(Select_range_check + Select_scan + Select_full_join) / Uptime',
test: 'value * 60 * 60 > 1',
issue: 'Many SELECTs are doing full table scans or joins without indexes.',
recommendation: 'Add indexes for the columns used in JOIN conditions and WHERE filters.',
justification: 'Index-less join+scan rate: %s per hour; aim for less than 1.',
justificationFormula: 'round(value * 3600, 2)',
requires: ['Select_range_check', 'Select_scan', 'Select_full_join', 'Uptime'],
);

$rules[] = new Rule(
// upstream id: "Rate of reading first index entry"
id: 'Handler_read_first_rate',
Expand Down
16 changes: 0 additions & 16 deletions tests/lib/Database/AdvisorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

use OCA\ServerInfo\Database\Advisor;
use OCA\ServerInfo\Database\ExpressionEvaluator;
use OCA\ServerInfo\Database\Rule;
use OCA\ServerInfo\Database\RuleResult;
use OCA\ServerInfo\Database\RuleSet\Mysql;
use OCA\ServerInfo\Database\Snapshot;
Expand Down Expand Up @@ -135,19 +134,4 @@ public function testReplicaLagPassesOnRunningReplica(): void {

$this->assertSame(RuleResult::STATUS_OK, $result->status);
}

/**
* Select_scan alone exceeds one per hour on any active Nextcloud, so the
* rule is a hint rather than a warning.
*/
public function testJoinWithoutIndexRateIsANotice(): void {
$result = $this->resultFor('Join_without_index_rate', [
'Select_range_check' => 0,
'Select_scan' => 50000,
'Select_full_join' => 0,
]);

$this->assertSame(RuleResult::STATUS_FAIL, $result->status);
$this->assertSame(Rule::SEVERITY_NOTICE, $result->rule->severity);
}
}
Loading