"Danilo Mota" <dmota@nexen.com.br> writes:
> SELECT
> rc.pkcliente
> FROM r_cliente AS rc
> INNER JOIN sav_cliente_lg AS sc ON sc.cpfcnpj = sc.cpfcnpj;
Surely you meant
INNER JOIN sav_cliente_lg AS sc ON rc.cpfcnpj = sc.cpfcnpj;
I would also venture that your statistics are desperately out of date,
because if the planner's estimates are close to reality, even this
unconstrained-cross-product join shouldn't have taken that long.
regards, tom lane