Em 08/04/2014 09:58, "Moisés P. Sena" <moisesps...@gmail.com> escreveu:
>
> Bom dia pessoal!
>
> Tenho as seguintes tabelas:
>
> create table a (
>   id SERIAL Primary key,
>   value vARCHAR(255)
> );
>
> create index a_value on a (value);
>
> create table b (
>     id SERIAL primary key,
>     a_id INT foreigk key references a(id),
>     value vARCHAR(255)
> );
>
> create index b_a_id on b (a_id);
>
> tenho milhoes de registros nas duas tabelas.
>
> JOIN:
>     SELECT b.* FROM b JOIN a a.id = b.a_id WHERE b.value = 'xx'
>
> FROM a,b:
>     SELECT b.* FROM a,b WHERE b.value = 'xx'
>
> Qual é mais rápido, JOIN ou FROM a,b e por quê?
>

os dois demoram o mesmo tempo. o que muda é a sintaxe. porem na hora de dar
manutencao no sql acho melhor usar o join. abs

> Abraços!!
>
> --
> Moisés P. Sena
> (Analista e desenvolvedor de sistemas WEB e mobile)
> http://www.moisespsena.com
> http://linux.moisespsena.com
>
> _______________________________________________
> pgbr-geral mailing list
> pgbr-geral@listas.postgresql.org.br
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
_______________________________________________
pgbr-geral mailing list
pgbr-geral@listas.postgresql.org.br
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a