ggergo/sqlindexhintbundle

This package is abandoned and no longer maintained. The author suggests using the shipmonk/doctrine-mysql-index-hints package instead.

Doctrine SqlWalker extension to apply USE INDEX and FORCE INDEX hints using DQL on top of MySql. Works with both createQuery and createQueryBuilder.

Maintainers

Package info

github.com/ggergo/SqlIndexHintBundle

pkg:composer/ggergo/sqlindexhintbundle

Statistics

Installs: 499 228

Dependents: 0

Suggesters: 0

Stars: 14

Open Issues: 1

v1.1.2 2022-02-07 11:12 UTC

This package is auto-updated.

Last update: 2025-05-23 11:14:16 UTC


README

Doctrine SqlWalker extension to apply USE INDEX and FORCE INDEX hints using DQL on top of MySQL. Works with both createQuery() and createQueryBuilder(). You can set different index hints per DQL table aliases.

Getting Started

Example:

use Ggergo\SqlIndexHintBundle\SqlIndexWalker;
use Doctrine\ORM\Query;
// ...
$query = '...';
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, SqlIndexWalker::class);
$query->setHint(SqlIndexWalker::HINT_INDEX, [
    'your_dql_table_alias'           => 'FORCE INDEX FOR JOIN (your_composite_index) FORCE INDEX FOR ORDER BY (PRIMARY)',
    'your_another_dql_table_alias'   => 'FORCE INDEX (PRIMARY)',
    // ...
]);

Installing

Require with Composer, i.e.:

composer require ggergo/sqlindexhintbundle