Se eu tiver uma tabela simples chamada: conn_log no meu Redshift/Postgresql
No desempenho da view, qual a diferença entre esses dois comandos?
select t1.wifi_name, (t2.sconn*100)::numeric/t1.ttconn
from (select wifi_name, count(*) as ttconn
from conn_log
group by wifi_name) t1,
(select wifi_name, count(*) as sconn
from conn_log
where success = 1
group by wifi_name) t2
where t1.wifi_name = t2.wifi_name;
segunda consulta:
select t1.wifi_name, (t2.sconn*100)::numeric/t1.ttconn
from (select wifi_name, count(*) as ttconn
from conn_log
group by wifi_name) t1
join
(select wifi_name, count(*) as sconn
from conn_log
where success = 1
group by wifi_name) t2
on t1.wifi_name = t2.wifi_name