How MySQL Optimizes DISTINCT?
Answer / Munnakumar
MySQL optimizes the DISTINCT keyword by eliminating duplicate rows as early as possible in the execution of a SELECT statement. To do this, it creates an intermediate temporary table with unique values and then selects from this table.nn- MySQL 5.6 or later versions use hash-based methods for optimizing DISTINCT queries with a smaller number of distinct values.nn- If the number of distinct values is large, MySQL will switch to a sort-based method (using sort_buffer_size and max_sort_length system variables) that sorts all rows first, then eliminates duplicates.
| Is This Answer Correct ? | 0 Yes | 0 No |
Describe mysql transaction properties.
What is difference between oracle sql and mysql?
What are the differences between a primary key and foreign key?
How you will Show unique records.
Is mysql relational?
What is truncate command?
How to delete the repeated records from a table?
How to use in conditions?
What is mysql architecture?
Can python connect to mysql?
In which format data is stored in mysql database?
Explain MySQL locks?
Oracle (3253)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)