Muitas vezes, você pode fazer com que essas consultas sejam executadas mais rapidamente ao contornar o
distinct usando um group by em vez de:select my_table.foo
from my_table
where [whatever where conditions you want]
group by foo;
distinct usando um group by em vez de:select my_table.foo
from my_table
where [whatever where conditions you want]
group by foo;