SQL_SMALL_RESULT
SQL_SMALL_RESULT is a MySQL-specific command modifier. When incorporated in a SELECT statement, it instructs the server to store the result set in memory, if it's small enough, instead of writing it to a temporary disk table. This may improve the performance of some queries. It's typically used when an ORDER BY clause is going to sort a few rows only. The decision to use memory or not belongs to the optimizer, based on the query and server configuration.
Example
Output
Explanation
The SQL_SMALL_RESULT
modifier is used in the SQL query. It informs MySQL to store the result of the query in a temporary table, which then sorts the table. This is useful when expecting a small result set from a large database.