Report question

Question: When is sql distinct faster than java programming 'distinct'