Zum Inhalt springen

Missing Index Candidate (ARCH7058)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

Key php.orm.missing-index-candidate · Severity info · Category orm

When a column is repeatedly used in filter/order/lookup predicates but has no index declaration, queries fall back to full table scans. Such columns are candidates for a DB index.

<?php
// 'email' is filtered often but has no index in the migration
Schema::create('users', function ($table) {
$table->id();
$table->string('email');
});
<?php
Schema::create('users', function ($table) {
$table->id();
$table->string('email')->index(); // index the frequently-filtered column
});

Add an appropriate database index to frequently filtered/sorted columns.