mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add missing index for device_perf (#11974)
Makes the latency page load faster in case of a large device_perf table
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddDevicePerfIndex extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('device_perf', function (Blueprint $table) {
|
||||
$table->index(['device_id', 'timestamp']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('device_perf', function (Blueprint $table) {
|
||||
$table->dropIndex(['device_id', 'timestamp']);
|
||||
});
|
||||
}
|
||||
}
|
@@ -605,6 +605,7 @@ device_perf:
|
||||
Indexes:
|
||||
PRIMARY: { Name: PRIMARY, Columns: [id], Unique: true, Type: BTREE }
|
||||
device_perf_device_id_index: { Name: device_perf_device_id_index, Columns: [device_id], Unique: false, Type: BTREE }
|
||||
device_perf_device_id_timestamp_index: { Name: device_perf_device_id_timestamp_index, Columns: [device_id, timestamp], Unique: false, Type: BTREE }
|
||||
device_relationships:
|
||||
Columns:
|
||||
- { Field: parent_device_id, Type: 'int unsigned', 'Null': false, Extra: '', Default: '0' }
|
||||
|
Reference in New Issue
Block a user