explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JDK

Settings
# exclusive inclusive rows x rows loops node
1. 2.821 135,536.290 ↓ 344.0 688 1

Sort (cost=66,499.48..66,499.48 rows=2 width=737) (actual time=135,536.229..135,536.290 rows=688 loops=1)

  • Sort Key: f.idempresa, (((date_part('year'::text, f.fecharendicion) * '100'::double precision) + date_part('month'::text, f.fecharendicion))), a.nroarticulo
  • Sort Method: quicksort Memory: 211kB
2. 0.076 135,533.469 ↓ 344.0 688 1

Append (cost=63,811.00..66,499.47 rows=2 width=737) (actual time=130,386.213..135,533.469 rows=688 loops=1)

3. 24.324 130,507.393 ↓ 481.0 481 1

GroupAggregate (cost=63,811.00..63,811.09 rows=1 width=737) (actual time=130,386.208..130,507.393 rows=481 loops=1)

  • Group Key: f.idempresa, e.nombreempresa, a.nroarticulo, a.descripcionarticulo, ae.factorconversion, ae.cantidadxembalaje, (((date_part('year'::text, f.fecharendicion) * '100'::double precision) + date_part('month'::text, f.fecharendicion))), (date_part('month'::text, f.fecharendicion)), cla.descripcionclasificacion, m.descripcionmarca, l.descripcionlinea, a.sku
4. 691.354 130,483.069 ↓ 65,423.0 65,423 1

Sort (cost=63,811.00..63,811.00 rows=1 width=687) (actual time=130,385.941..130,483.069 rows=65,423 loops=1)

  • Sort Key: f.idempresa, e.nombreempresa, a.nroarticulo, a.descripcionarticulo, ae.factorconversion, ae.cantidadxembalaje, (((date_part('year'::text, f.fecharendicion) * '100'::double precision) + date_part('month'::text, f.fecharendicion))), (date_part('month'::text, f.fecharendicion)), cla.descripcionclasificacion, m.descripcionmarca, l.descripcionlinea, a.sku
  • Sort Method: external merge Disk: 13032kB
5. 354.055 129,791.715 ↓ 65,423.0 65,423 1

Nested Loop Left Join (cost=2,704.86..63,810.99 rows=1 width=687) (actual time=95.111..129,791.715 rows=65,423 loops=1)

6. 0.000 227.235 ↓ 65,423.0 65,423 1

Gather (cost=2,704.29..63,717.35 rows=1 width=662) (actual time=91.962..227.235 rows=65,423 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
7. 122.445 2,085.680 ↓ 32,712.0 32,712 2

Nested Loop (cost=1,704.29..62,717.25 rows=1 width=662) (actual time=66.128..2,085.680 rows=32,712 loops=2)

8. 123.259 1,963.232 ↓ 6,608.8 33,044 2

Nested Loop (cost=1,704.01..62,710.50 rows=5 width=670) (actual time=66.047..1,963.232 rows=33,044 loops=2)

9. 34.385 1,839.971 ↓ 6,608.8 33,044 2

Hash Join (cost=1,703.74..62,703.55 rows=5 width=651) (actual time=65.982..1,839.971 rows=33,044 loops=2)

  • Hash Cond: (f.idempresa = e.id)
10. 165.302 1,805.399 ↓ 6,608.8 33,044 2

Nested Loop (cost=1,702.09..62,701.88 rows=5 width=135) (actual time=65.225..1,805.399 rows=33,044 loops=2)

11. 209.810 1,640.093 ↓ 6,608.8 33,044 2

Hash Join (cost=1,701.81..62,694.70 rows=5 width=116) (actual time=65.123..1,640.093 rows=33,044 loops=2)

  • Hash Cond: (df.idarticuloembalaje = ae.id)
12. 1,056.038 1,374.494 ↓ 31.3 82,272 2

Nested Loop (cost=17.52..61,000.51 rows=2,626 width=38) (actual time=9.223..1,374.494 rows=82,272 loops=2)

13. 301.282 318.412 ↓ 37.5 22,270 2

Parallel Bitmap Heap Scan on factura f (cost=16.95..1,356.77 rows=594 width=24) (actual time=9.084..318.412 rows=22,270 loops=2)

  • Recheck Cond: ((fecharendicion >= ((date_trunc('month'::text, (CURRENT_DATE)::timestamp with time zone) - '1 mon'::interval))::date) AND (fecharendicion <= ((date_trunc('MONTH'::text, (CURRENT_DATE)::timestamp with time zone) + '1 mon -1 days'::interval))::date))
  • Filter: ((estado <> 2) AND (idempresa = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,26,27}'::bigint[])))
  • Rows Removed by Filter: 3454
  • Heap Blocks: exact=1
14. 17.130 17.130 ↓ 43.5 51,526 1

Bitmap Index Scan on "factura_IX_FechaRendicion" (cost=0.00..16.70 rows=1,184 width=0) (actual time=17.130..17.130 rows=51,526 loops=1)

  • Index Cond: ((fecharendicion >= ((date_trunc('month'::text, (CURRENT_DATE)::timestamp with time zone) - '1 mon'::interval))::date) AND (fecharendicion <= ((date_trunc('MONTH'::text, (CURRENT_DATE)::timestamp with time zone) + '1 mon -1 days'::interval))::date))
15. 0.044 0.044 ↑ 24.8 4 44,541

Index Scan using "detallefactura_IX_IDFactura" on detallefactura df (cost=0.56..99.42 rows=99 width=30) (actual time=0.021..0.044 rows=4 loops=44,541)

  • Index Cond: (idfactura = f.id)
16. 9.417 55.789 ↓ 164.7 9,224 2

Hash (cost=1,683.59..1,683.59 rows=56 width=94) (actual time=55.789..55.789 rows=9,224 loops=2)

  • Buckets: 16384 (originally 1024) Batches: 1 (originally 1) Memory Usage: 1280kB
17. 22.215 46.372 ↓ 164.7 9,224 2

Nested Loop (cost=194.93..1,683.59 rows=56 width=94) (actual time=2.436..46.372 rows=9,224 loops=2)

18. 2.699 24.155 ↓ 167.8 9,734 2

Hash Join (cost=194.64..1,595.61 rows=58 width=70) (actual time=2.288..24.155 rows=9,734 loops=2)

  • Hash Cond: (a.idproveedor = p.id)
19. 19.254 19.254 ↑ 1.0 30,619 2

Seq Scan on articulo a (cost=0.00..1,320.49 rows=30,649 width=78) (actual time=0.049..19.254 rows=30,619 loops=2)

20. 0.060 2.202 ↑ 1.0 28 2

Hash (cost=194.29..194.29 rows=28 width=8) (actual time=2.162..2.202 rows=28 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
21. 2.142 2.142 ↑ 1.0 28 2

Index Scan using "proveedor_UQ_Proveedor_LegacyPK" on proveedor p (cost=0.29..194.29 rows=28 width=8) (actual time=0.144..2.142 rows=28 loops=2)

  • Index Cond: (codproveedor = 1)
22. 0.002 0.002 ↑ 1.0 1 19,468

Index Scan using "articuloembalaje_UQ_ArticuloEmbalaje_LegacyPK" on articuloembalaje ae (cost=0.29..1.51 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=19,468)

  • Index Cond: (idarticulo = a.id)
23. 0.004 0.004 ↑ 1.0 1 66,087

Index Scan using "PK_dbo.marca" on marca m (cost=0.28..1.44 rows=1 width=35) (actual time=0.004..0.004 rows=1 loops=66,087)

  • Index Cond: (id = a.idmarca)
24. 0.071 0.187 ↑ 1.0 29 2

Hash (cost=1.29..1.29 rows=29 width=524) (actual time=0.187..0.187 rows=29 loops=2)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
25. 0.116 0.116 ↑ 1.0 29 2

Seq Scan on empresa e (cost=0.00..1.29 rows=29 width=524) (actual time=0.112..0.116 rows=29 loops=2)

26. 0.002 0.002 ↑ 1.0 1 66,087

Index Scan using "PK_dbo.linea" on linea l (cost=0.27..1.39 rows=1 width=35) (actual time=0.002..0.002 rows=1 loops=66,087)

  • Index Cond: (id = a.idlinea)
27. 0.003 0.003 ↑ 1.0 1 66,087

Index Scan using "PK_dbo.tipoarticulo" on tipoarticulo tp (cost=0.28..1.33 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=66,087)

  • Index Cond: (id = a.idtipoarticulo)
  • Filter: (codtipoarticulo = 1)
  • Rows Removed by Filter: 0
28. 0.000 129,210.425 ↑ 1.0 1 65,423

Nested Loop (cost=0.57..93.61 rows=1 width=33) (actual time=0.790..1.975 rows=1 loops=65,423)

29. 8,832.105 48,020.482 ↓ 44.9 1,483 65,423

Nested Loop (cost=0.28..41.62 rows=33 width=33) (actual time=0.004..0.734 rows=1,483 loops=65,423)

30. 327.115 327.115 ↓ 22.0 22 65,423

Seq Scan on tipoclasificacionarticulo tca (cost=0.00..1.60 rows=1 width=8) (actual time=0.001..0.005 rows=22 loops=65,423)

  • Filter: (codtipoclasificacion = 1)
  • Rows Removed by Filter: 27
31. 38,861.262 38,861.262 ↓ 2.0 67 1,439,306

Index Scan using "clasificacionarticulo_UQ_ClasificacionArticulo_LegacyPK" on clasificacionarticulo cla (cost=0.28..39.68 rows=34 width=41) (actual time=0.011..0.027 rows=67 loops=1,439,306)

  • Index Cond: (idtipoclasificacion = tca.id)
32. 97,022.309 97,022.309 ↓ 0.0 0 97,022,309

Index Scan using "articuloclasificacionarticulo_UQ_ArticuloClasificacionArticulo_" on articuloclasificacionarticulo acla (cost=0.29..1.57 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=97,022,309)

  • Index Cond: ((idclasificacion = cla.id) AND (a.id = idarticulo))
  • Filter: activo
33. 2.196 5,026.000 ↓ 207.0 207 1

GroupAggregate (cost=2,688.24..2,688.35 rows=1 width=737) (actual time=5,024.617..5,026.000 rows=207 loops=1)

  • Group Key: nc.idempresa, e_1.nombreempresa, a_1.nroarticulo, a_1.descripcionarticulo, ae_1.factorconversion, ae_1.cantidadxembalaje, (((date_part('year'::text, nc.fechaemision) * '100'::double precision) + date_part('month'::text, nc.fechaemision))), (date_part('month'::text, nc.fechaemision)), cla_1.descripcionclasificacion, m_1.descripcionmarca, l_1.descripcionlinea, a_1.sku
34. 10.745 5,023.804 ↓ 1,260.0 1,260 1

Sort (cost=2,688.24..2,688.25 rows=1 width=687) (actual time=5,023.662..5,023.804 rows=1,260 loops=1)

  • Sort Key: nc.idempresa, e_1.nombreempresa, a_1.nroarticulo, a_1.descripcionarticulo, ae_1.factorconversion, ae_1.cantidadxembalaje, (((date_part('year'::text, nc.fechaemision) * '100'::double precision) + date_part('month'::text, nc.fechaemision))), (date_part('month'::text, nc.fechaemision)), cla_1.descripcionclasificacion, m_1.descripcionmarca, l_1.descripcionlinea, a_1.sku
  • Sort Method: quicksort Memory: 383kB
35. 5.112 5,013.059 ↓ 1,260.0 1,260 1

Nested Loop (cost=197.75..2,688.23 rows=1 width=687) (actual time=310.007..5,013.059 rows=1,260 loops=1)

36. 5.509 5,004.167 ↓ 1,260.0 1,260 1

Nested Loop Left Join (cost=197.47..2,687.93 rows=1 width=660) (actual time=309.933..5,004.167 rows=1,260 loops=1)

37. 1.825 2,371.558 ↓ 1,260.0 1,260 1

Nested Loop (cost=196.91..2,623.63 rows=1 width=643) (actual time=309.306..2,371.558 rows=1,260 loops=1)

38. 2.438 2,365.071 ↓ 310.8 1,554 1

Nested Loop (cost=196.63..2,622.15 rows=5 width=651) (actual time=309.261..2,365.071 rows=1,554 loops=1)

39. 4.198 2,359.525 ↓ 310.8 1,554 1

Nested Loop (cost=196.49..2,621.38 rows=5 width=143) (actual time=309.024..2,359.525 rows=1,554 loops=1)

40. 2.939 2,350.665 ↓ 310.8 1,554 1

Nested Loop (cost=196.21..2,619.88 rows=5 width=124) (actual time=308.618..2,350.665 rows=1,554 loops=1)

41. 0.000 2,139.490 ↓ 310.8 1,554 1

Nested Loop (cost=195.78..2,614.11 rows=5 width=124) (actual time=307.230..2,139.490 rows=1,554 loops=1)

42. 46.138 1,328.539 ↓ 94.0 116,807 1

Nested Loop (cost=195.36..1,978.37 rows=1,243 width=116) (actual time=5.791..1,328.539 rows=116,807 loops=1)

43. 5.339 64.833 ↓ 164.7 9,224 1

Nested Loop (cost=194.93..1,616.20 rows=56 width=94) (actual time=1.524..64.833 rows=9,224 loops=1)

44. 5.940 30.292 ↓ 167.8 9,734 1

Hash Join (cost=194.64..1,595.61 rows=58 width=70) (actual time=1.339..30.292 rows=9,734 loops=1)

  • Hash Cond: (a_1.idproveedor = p_1.id)
45. 23.211 23.211 ↑ 1.0 30,619 1

Seq Scan on articulo a_1 (cost=0.00..1,320.49 rows=30,649 width=78) (actual time=0.102..23.211 rows=30,619 loops=1)

46. 0.010 1.141 ↑ 1.0 28 1

Hash (cost=194.29..194.29 rows=28 width=8) (actual time=1.141..1.141 rows=28 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
47. 1.131 1.131 ↑ 1.0 28 1

Index Scan using "proveedor_UQ_Proveedor_LegacyPK" on proveedor p_1 (cost=0.29..194.29 rows=28 width=8) (actual time=0.146..1.131 rows=28 loops=1)

  • Index Cond: (codproveedor = 1)
48. 29.202 29.202 ↑ 1.0 1 9,734

Index Scan using "articuloembalaje_UQ_ArticuloEmbalaje_LegacyPK" on articuloembalaje ae_1 (cost=0.29..0.34 rows=1 width=32) (actual time=0.003..0.003 rows=1 loops=9,734)

  • Index Cond: (idarticulo = a_1.id)
49. 1,217.568 1,217.568 ↑ 14.2 13 9,224

Index Scan using "detallenotacredito_IX_IdArticuloEmbalaje" on detallenotacredito dnc (cost=0.42..4.63 rows=184 width=38) (actual time=0.008..0.132 rows=13 loops=9,224)

  • Index Cond: (idarticuloembalaje = ae_1.id)
50. 817.649 817.649 ↓ 0.0 0 116,807

Index Scan using "PK_dbo.notacredito" on notacredito nc (cost=0.42..0.51 rows=1 width=24) (actual time=0.007..0.007 rows=0 loops=116,807)

  • Index Cond: (id = dnc.idnotacredito)
  • Filter: ((estado <> 2) AND (fechaemision >= ((date_trunc('month'::text, (CURRENT_DATE)::timestamp with time zone) - '1 mon'::interval))::date) AND (fechaemision <= ((date_trunc('MONTH'::text, (CURRENT_DATE)::timestamp with time zone) + '1 mon -1 days'::interval))::date) AND (idempresa = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,26,27}'::bigint[])))
  • Rows Removed by Filter: 1
51. 208.236 208.236 ↑ 1.0 1 1,554

Index Scan using "PK_dbo.factura" on factura f_1 (cost=0.43..1.15 rows=1 width=16) (actual time=0.134..0.134 rows=1 loops=1,554)

  • Index Cond: (id = dnc.idfactura)
52. 4.662 4.662 ↑ 1.0 1 1,554

Index Scan using "PK_dbo.marca" on marca m_1 (cost=0.28..0.30 rows=1 width=35) (actual time=0.003..0.003 rows=1 loops=1,554)

  • Index Cond: (id = a_1.idmarca)
53. 3.108 3.108 ↑ 1.0 1 1,554

Index Scan using "PK_dbo.empresa" on empresa e_1 (cost=0.14..0.16 rows=1 width=524) (actual time=0.002..0.002 rows=1 loops=1,554)

  • Index Cond: (id = f_1.idempresa)
54. 4.662 4.662 ↑ 1.0 1 1,554

Index Scan using "PK_dbo.tipoarticulo" on tipoarticulo tp_1 (cost=0.28..0.30 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=1,554)

  • Index Cond: (id = a_1.idtipoarticulo)
  • Filter: (codtipoarticulo = 1)
  • Rows Removed by Filter: 0
55. 0.000 2,627.100 ↑ 1.0 1 1,260

Nested Loop (cost=0.57..64.29 rows=1 width=33) (actual time=0.996..2.085 rows=1 loops=1,260)

56. 190.260 973.980 ↓ 44.9 1,483 1,260

Nested Loop (cost=0.28..40.19 rows=33 width=33) (actual time=0.006..0.773 rows=1,483 loops=1,260)

57. 7.560 7.560 ↓ 22.0 22 1,260

Seq Scan on tipoclasificacionarticulo tca_1 (cost=0.00..1.60 rows=1 width=8) (actual time=0.002..0.006 rows=22 loops=1,260)

  • Filter: (codtipoclasificacion = 1)
  • Rows Removed by Filter: 27
58. 776.160 776.160 ↓ 2.0 67 27,720

Index Scan using "clasificacionarticulo_UQ_ClasificacionArticulo_LegacyPK" on clasificacionarticulo cla_1 (cost=0.28..38.25 rows=34 width=41) (actual time=0.011..0.028 rows=67 loops=27,720)

  • Index Cond: (idtipoclasificacion = tca_1.id)
59. 1,868.580 1,868.580 ↓ 0.0 0 1,868,580

Index Scan using "articuloclasificacionarticulo_UQ_ArticuloClasificacionArticulo_" on articuloclasificacionarticulo acla_1 (cost=0.29..0.72 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=1,868,580)

  • Index Cond: ((idclasificacion = cla_1.id) AND (a_1.id = idarticulo))
  • Filter: activo
60. 3.780 3.780 ↑ 1.0 1 1,260

Index Scan using "PK_dbo.linea" on linea l_1 (cost=0.27..0.29 rows=1 width=35) (actual time=0.003..0.003 rows=1 loops=1,260)

  • Index Cond: (id = a_1.idlinea)