Download the PHP package shipmonk/doctrine-mysql-optimizer-hints without Composer

On this page you can find all versions of the php package shipmonk/doctrine-mysql-optimizer-hints. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-mysql-optimizer-hints

MySQL optimizer hints for Doctrine

This library provides a simple way to incorporate MySQL's optimizer hints into SELECT queries written in Doctrine Query Language via custom SqlWalker. No need for native queries anymore.

Installation:

Example usage:

Which produces following SQL:

Be careful what you place as optimizer hint, you are basically writing SQL there, but MySQL produces only warnings when a typo is made there.

Use cases:

Limiting / extending max execution time for a single query:

Any reasonable application uses some global max_execution_time to avoid queries running for hours. But you may want to break this limitation for a single long-running query. Doing so by SET max_execution_time = 10000; is tricky as you should revert that to previous value just after the query ends. This results in complex code around it, optimizer hint does that for you for free:

Query optimization:

Sometimes, forcing some index usage is not enough and you need to help MySQL optimizer to adjust the order of tables in execution plan. Join-order optimizer hints are the way to go. Simpliest usage is to force the table order to be exactly as you wrote it is using JOIN_FIXED_ORDER():

Testing invisible index:

When dealing with complex query optimization on production, you can only guess if the new index you thought up will help or not. Since MySQL 8.0, you can create invisible index (those are maintained by the engine, but not used). But you can enable invisible indexes for the query you want to test:

Enlarging group_concat limit for a single query

Default limit of group_concat_max_len is 1024, but you can make it bigger:

Combining with index hints:

Since 2.0.0, you can combine this library with shipmonk/doctrine-mysql-index-hint:


All versions of doctrine-mysql-optimizer-hints with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
shipmonk/doctrine-hint-driven-sql-walker Version ^2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shipmonk/doctrine-mysql-optimizer-hints contains the following files

Loading the files please wait ....