* work_mem = 1MB*

QUERY PLAN

------------------------------------------------------------------------------------------------------------------------

GroupAggregate (cost=114030.00..119682.56 rows=22839 width=50) (actual
time=2116.395..3020.904 rows=13225 loops=1)

-> Sort (cost=114030.00..114600.97 rows=228386 width=50) (actual
time=2116.377..2717.973 rows=184488 loops=1)

Sort Key: "seqAgrupamento", "prod_CFOP", "prod_NCM"

*Sort Method: external merge Disk: 12360kB*

-> Bitmap Heap Scan on stg1_nfe_item_proc item (cost=5201.58..78085.37
rows=228386 width=50) (actual time=37.296..146.287 rows=184488 loops=1)

Recheck Cond: ((("emit_cMun")::text = '3550308'::text) AND
(("ide_tpNF")::text = '1'::text))

-> Bitmap Index Scan on "S1IP_I01" (cost=0.00..5144.49 rows=228386 width=0)
(actual time=36.352..36.352 rows=184488 loops=1)

Index Cond: ((("emit_cMun")::text = '3550308'::text) AND (("ide_tpNF")::text
= '1'::text))

*Total runtime: 3026.089 ms*

*****************************************************************************************************************************
*
*

*work_mem = 16MB*

  QUERY PLAN

------------------------------------------------------------------------------------------------------------------------

HashAggregate (cost=82653.09..83166.97 rows=22839 width=50) (actual
time=486.177..496.042 rows=13225 loops=1)

-> Bitmap Heap Scan on stg1_nfe_item_proc item (cost=5201.58..78085.37
rows=228386 width=50) (actual time=36.831..89.838 rows=184488 loops=1)

Recheck Cond: ((("emit_cMun")::text = '3550308'::text) AND
(("ide_tpNF")::text = '1'::text))

-> Bitmap Index Scan on "S1IP_I01" (cost=0.00..5144.49 rows=228386 width=0)
(actual time=35.868..35.868 rows=184488 loops=1)

Index Cond: ((("emit_cMun")::text = '3550308'::text) AND (("ide_tpNF")::text
= '1'::text))

Total runtime: 497.319 ms






2009/12/4 Dickson S. Guedes <[email protected]>

> 2009/12/4 Thiago Freitas <[email protected]>:
> > Eu alterei o wok_mem para 16MB e a consulta que demorava 3 segundos caiu
> > para menos de meio segundo.
> >
> > Pessoal, obrigado pela ajuda!
>
>
> E quanto ao plano? Consegue postar aqui? Rodou o ANALYZE nas tabelas
> envolvidas?
>
>
> []s
> Dickson S. Guedes
> mail/xmpp: [email protected] - skype: guediz
> http://guedesoft.net - http://www.postgresql.org.br
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a