final class IndexHint
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

One index hint of a table reference: USE|FORCE|IGNORE INDEX [FOR scope] (indexes).

USE accepts an empty list, which asks for no index; FORCE and IGNORE name at least one index. The names are not checked against declarations: the analysis context holds no indexes. Source: https://dev.mysql.com/doc/refman/8.4/en/index-hints.html.

Reading an index hintdoctest
$query = (new \SqlSemantics\Platform\MySql\Semantics())->analyze('SELECT a FROM t IGNORE KEY FOR GROUP BY (i, j)');
    [$query->statement->from->indexHints[0]->action, count($query->statement->from->indexHints[0]->indexes)] // => [\SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHintAction::Ignore, 2]
Refusing FORCE INDEX without an indexdoctest
new \SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHint(\SqlSemantics\Platform\MySql\Statement\Relation\Hint\IndexHintAction::Force, null, []) // throws \SqlSemantics\Platform\MySql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Name|PrimaryIndex> $indexes
public IndexHintScope|null $scope

Methods§

public function __construct(
    public IndexHintAction $action,
    public IndexHintScope|null $scope,
    list<Name|Node> $indexes,
)

Parameters

$actionIndexHintActionWhat the hint asks
$scopeIndexHintScope|nullThe part of processing it applies to
$indexeslist<Name|Node>The indexes in written order, each a name or the primary key
Calls 2
public function render(Output $out): void

Writes the hint.

Parameters

$outOutput
Calls 8

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 2

Relations§

Instantiated in 1
Constant reads 1
Type declarations 1