mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Improve device ports loading speed (#16500)
* Improve device ports loading speed Add port->vlans relationship index as discovered missing here: https://community.librenms.org/t/device-ports-page-delay-loading-due-to-slow-db-query/26207 * update db_schema.yaml
This commit is contained in:
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('ports_vlans', function (Blueprint $table) {
|
||||||
|
$table->index('port_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('ports_vlans', function (Blueprint $table) {
|
||||||
|
$table->dropIndex('ports_vlans_port_id_index');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -1794,6 +1794,7 @@ ports_vlans:
|
|||||||
Indexes:
|
Indexes:
|
||||||
PRIMARY: { Name: PRIMARY, Columns: [port_vlan_id], Unique: true, Type: BTREE }
|
PRIMARY: { Name: PRIMARY, Columns: [port_vlan_id], Unique: true, Type: BTREE }
|
||||||
ports_vlans_device_id_port_id_vlan_unique: { Name: ports_vlans_device_id_port_id_vlan_unique, Columns: [device_id, port_id, vlan], Unique: true, Type: BTREE }
|
ports_vlans_device_id_port_id_vlan_unique: { Name: ports_vlans_device_id_port_id_vlan_unique, Columns: [device_id, port_id, vlan], Unique: true, Type: BTREE }
|
||||||
|
ports_vlans_port_id_index: { Name: ports_vlans_port_id_index, Columns: [port_id], Unique: false, Type: BTREE }
|
||||||
port_groups:
|
port_groups:
|
||||||
Columns:
|
Columns:
|
||||||
- { Field: id, Type: 'int unsigned', 'Null': false, Extra: auto_increment }
|
- { Field: id, Type: 'int unsigned', 'Null': false, Extra: auto_increment }
|
||||||
|
Reference in New Issue
Block a user