Actually, he is the reason why the CTE version of the query is faster: instead of grouping all records to build the distinct list it just jumps over the index keys. (This access method is called loose index scan and MySQL supports it natively, but in SQL Server and other systems you need to resort to the dirty tricks like that to emulate it)The dedicated table with the products will of course spe