Skip to content

EasyConceptSQL

What does DISTINCT do and what does it cost on a large table?

What a good answer covers

DISTINCT removes duplicate result rows, which usually needs a sort or hash over the selected columns, so it can be expensive on wide, large results. Prefer fixing the join that creates duplicates over hiding them with DISTINCT.