Ola Qual a estrutura das duas tabelas envolvidas Existe um indice por codpedido nas tabelas receber e pedido?
[]s Luiz ----- Original Message ----- From: "José Carlos Messias" <[EMAIL PROTECTED]> To: "Comunidade PostgreSQL Brasileira" <pgbr-geral@listas.postgresql.org.br> Sent: Tuesday, August 19, 2008 4:43 PM Subject: [pgbr-geral] consulta lenta, ajuda interpretar explain Galera, Pode estar na cara mas não estou conseguindo interpretar o explain e a consulta está muito lenta. Vejam: SELECT receber.codpedido, max(receber.rec_parcela) AS max_rec_parcela FROM receber JOIN pedido ON pedido.codpedido = receber.codpedido WHERE pedido.status = 4 OR pedido.status = 44 OR pedido.status = 59 GROUP BY receber.codpedido; QUERY PLAN ---------------------------------------------------------------------------------------------------------------- HashAggregate (cost=118925.43..119785.92 rows=68839 width=8) -> Hash Join (cost=42712.73..114110.34 rows=963017 width=8) Hash Cond: ("outer".codpedido = "inner".codpedido) -> Seq Scan on receber (cost=0.00..31467.72 rows=1432772 width=8) -> Hash (cost=39719.05..39719.05 rows=405474 width=4) -> Bitmap Heap Scan on pedido (cost=2560.18..39719.05 rows=405474 width=4) Recheck Cond: ((status = 4) OR (status = 44) OR (status = 59)) -> BitmapOr (cost=2560.18..2560.18 rows=408907 width=0) -> Bitmap Index Scan on idx_pedido_status (cost=0.00..2524.24 rows=403783 width=0) Index Cond: (status = 4) -> Bitmap Index Scan on idx_pedido_status (cost=0.00..17.97 rows=2562 width=0) Index Cond: (status = 44) -> Bitmap Index Scan on idx_pedido_status (cost=0.00..17.97 rows=2562 width=0) Index Cond: (status = 59) _______________________________________________ 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