explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FSaQ : SELECT DP.COD_FAMILIA, DP.FAMILIA, SUM(F.QUANTIDADE_VENDA) AS QUANTIDADE_VENDAS, SUM(F.REAIS_VENDA) AS VALOR_VENDAS, SUM(F.QUANTIDADE_PREVISAO) AS QUANTIDADE_PREVISTA, SUM(F.REAIS_PREVISAO) AS VALOR_PREVISTO, SUM(F.QUANTIDADE_PEDIDO) AS QUANTIDADE_PEDIDO, SUM(F.REAIS_PEDIDO) AS VALOR_PEDIDO, SUM(F.QUANTIDADE_PEDIDO + F.QUANTIDADE_VENDA) AS QUANTIDADE_TOTAL, SUM(F.REAIS_PEDIDO + F.REAIS_VENDA) AS VALOR_TOTAL FROM FATO_PREVISAO_VENDA_PEDIDO_SAFRA_MES F, DIM_TEMPO_MES DTD, DIM_EMPRESA DE, DIM_PRODUTO DP, DIM_CLIENTE_LOCAL DCL WHERE DTD.SK_TEMPO_MES = F.SK_TEMPO_MES AND DTD.ANO = 2018 AND DTD.MES <= 12 AND DE.SK_EMPRESA = F.SK_EMPRESA AND DE.COD_FILIAL IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,141,142,143,144,145,146,147,148,149,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,167,168,169,170,171,172,173,174,175,177,179,181,187,188,189,190,192,193,198,197,199,204,207,208,182,183,184,209,210,211,212,213,214,194,195,215,216,96,97,98,99,100,150,166,196,140,185,180,176,-1) AND DP.SK_PRODUTO = F.SK_PRODUTO AND DCL.SK_CLIENTE_LOCAL = F.SK_CLIENTE_LOCAL AND (DCL.ATIVO = ( 'TODOS' ) OR 'TODOS' = ('TODOS')) GROUP BY 1,2

Settings
# exclusive inclusive rows x rows loops node
1. 0.158 55.012 ↑ 11.4 71 1

Sort (cost=146.63..148.65 rows=808 width=138) (actual time=55.009..55.012 rows=71 loops=1)

  • Sort Key: n.nspname, p.proname, (pg_get_function_arguments(p.oid))
  • Sort Method: quicksort Memory: 43kB
2. 1.378 54.854 ↑ 11.4 71 1

Hash Join (cost=1.14..107.61 rows=808 width=138) (actual time=42.495..54.854 rows=71 loops=1)

  • Hash Cond: (p.pronamespace = n.oid)
3. 53.465 53.465 ↓ 3.0 2,402 1

Seq Scan on pg_proc p (cost=0.00..89.30 rows=808 width=78) (actual time=0.052..53.465 rows=2,402 loops=1)

  • Filter: pg_function_is_visible(oid)
4. 0.004 0.011 ↑ 1.0 4 1

Hash (cost=1.09..1.09 rows=4 width=68) (actual time=0.011..0.011 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1kB
5. 0.007 0.007 ↑ 1.0 4 1

Seq Scan on pg_namespace n (cost=0.00..1.09 rows=4 width=68) (actual time=0.005..0.007 rows=4 loops=1)

  • Filter: ((nspname <> 'pg_catalog'::name) AND (nspname <> 'information_schema'::name))