Skip to content

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

License

Notifications You must be signed in to change notification settings

ljmaskey/SqlIndexHintBundle

 
 

Repository files navigation

USE INDEX and FORCE INDEX using Doctrine MySQL

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%