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ê?

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
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a