How can re-write the distinct query with range scan in 'WHERE' condition.
Last updated on APRIL 02, 2017
Applies to:MySQL Server - Version 5.5 and later
Information in this document applies to any platform.
Assume table has index (a,b) and query is following 'SELECT distinct(a) FROM tbl WHERE b=1', the optimizer would use 'Loose Index scan'.
However if condition has range scan, 'Loose Index scan' would not working properly.
Learn how can re-write the query to use 'Loose Index scan' and figure out the difference in 'covering index' and 'table random access' and 'loose index scan' referring MySQL 5.6 result.
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
Million Knowledge Articles and hundreds of Community platforms