Primero, no hay necesidad de distinct . La consulta se puede escribir como:
select *
from example@sqldat.com
where column1 in (
select column2
from example@sqldat.com
where column3 > 0
)
order by column1
En segundo lugar, hay (al menos) dos formas más de escribirlo. Ya sea con JOIN :
select t1.*
from example@sqldat.com t1
join example@sqldat.com t2
where t2.column2 = t1.column1
and t2.column3 > 0
group by
t1.id, t1.column1, ...
order by t1.column1
o (mi preferencia) con EXISTS :
select t1.*
from example@sqldat.com t1
where exists
( select *
from example@sqldat.com
where t2.column2 = t1.column1
and t2.column3 > 0
)
order by column1
En cualquier caso, debe consultar los planes de ejecución de todos ellos.
Espero que el rendimiento sea mejor si tiene un índice en table1.column1 y para table2 , ya sea un índice en column2 o un índice compuesto en (column3, column2)