explain.depesz.com

PostgreSQL's explain analyze made readable

Result: H2yl

Settings
# exclusive inclusive rows x rows loops node
1. 2,279.572 2,563.351 ↑ 1.0 100 1

Limit (cost=3,051,871,134.88..3,051,871,143.38 rows=100 width=457) (actual time=2,563.263..2,563.351 rows=100 loops=1)

  • Functions: 184
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 21.108 ms, Inlining 67.024 ms, Optimization 1299.968 ms, Emission 910.025 ms, Total 2298.126 ms
2. 0.087 283.779 ↑ 2,134,221.0 100 1

Unique (cost=3,051,871,134.88..3,070,012,013.47 rows=213,422,101 width=457) (actual time=283.698..283.779 rows=100 loops=1)

3. 0.369 283.692 ↑ 2,134,221.0 100 1

Sort (cost=3,051,871,134.88..3,052,404,690.14 rows=213,422,101 width=457) (actual time=283.686..283.692 rows=100 loops=1)

  • Sort Key: ct.fecha_cobro DESC, ct.id, ct.fecha, ct.activo, (CASE WHEN ct.activo THEN 'Si'::text ELSE 'No'::text END), ct.fecha_emision, ct.numero, (initcap(ct.titular)), ct.importe, ct.t_cheque_tipo_id, (concat(tct.nombre, CASE WHEN (bce.id IS NOT NULL) THEN concat(' ', bce.nombre) ELSE NULL::text END)), ct.banco_cuenta_id, bce.nombre, tcte.id, (initcap(tcte.nombre)), tcte.color, b.id, (initcap(b.nombre)), u.id, (initcap(concat(u.apellido, ', ', u.nombre))), (((((b.nombre || ' ['::text) || ct.titular) || '] #'::text) || ct.numero)), ct.cheque_tercero_deposito_id, (CASE WHEN (ct.cheque_tercero_deposito_id IS NOT NULL) THEN concat(bc.nombre, ' el ', to_char(ctd.fecha_movimiento, 'dd/mm/yy'::text)) ELSE NULL::text END), (CASE WHEN ((pop.id IS NOT NULL) AND (ct.cliente_recibo_id = cr.id)) THEN pop.numero ELSE NULL::integer END), pop.id, cd.id, (CASE WHEN ((pop.id IS NOT NULL) AND (ct.cliente_recibo_id = cr.id)) THEN concat('[OP] Numero ', pop.numero, ' | Pr.: ', COALESCE(p.razon_social, p.nombre_fantasia)) WHEN ((cd.id IS NOT NULL) AND (ct.cliente_recibo_id = crdc.id)) THEN concat('[Dev] Recibo ', cr.numero, ' | Cl.: ', cli.razon_social) ELSE NULL::text END), ct.cliente_recibo_id, cli.razon_social, (COALESCE(cr.cliente_id, cd.cliente_id)), cli.exterior, ((SubPlan 1)), ct.t_cheque_tercero_estado_id
  • Sort Method: quicksort Memory: 141kB
4. 1.382 283.323 ↑ 830,436.2 257 1

Nested Loop Left Join (cost=1,181.93..2,996,917,866.96 rows=213,422,101 width=457) (actual time=114.109..283.323 rows=257 loops=1)

  • Join Filter: (ct.banco_cuenta_id = bce.id)
  • Rows Removed by Join Filter: 1,275
5. 0.095 281.941 ↑ 830,436.2 257 1

Hash Left Join (cost=1,181.93..2,971,307,213.78 rows=213,422,101 width=400) (actual time=114.027..281.941 rows=257 loops=1)

  • Hash Cond: (ct.t_cheque_tipo_id = tct.id)
6. 0.069 281.817 ↑ 830,436.2 257 1

Hash Left Join (cost=1,152.81..2,970,744,158.32 rows=213,422,101 width=368) (actual time=113.973..281.817 rows=257 loops=1)

  • Hash Cond: (pop.proveedor_id = p.id)
7. 0.136 280.707 ↑ 830,436.2 257 1

Nested Loop Left Join (cost=1,109.03..2,970,178,924.69 rows=213,422,101 width=337) (actual time=112.908..280.707 rows=257 loops=1)

  • Join Filter: (ct.id = cdfd.cheque_tercero_id)
  • Rows Removed by Join Filter: 4,112
8. 0.503 280.057 ↑ 830,436.2 257 1

Hash Right Join (cost=1,108.61..2,944,568,256.53 rows=213,422,101 width=313) (actual time=112.728..280.057 rows=257 loops=1)

  • Hash Cond: (cr.id = ct.cliente_recibo_id)
9. 0.763 271.788 ↑ 18,613.7 1,031 1

Hash Right Join (cost=473.82..2,916,309,255.62 rows=19,190,741 width=51) (actual time=11.213..271.788 rows=1,031 loops=1)

  • Hash Cond: (cli.id = cr.cliente_id)
10. 0.938 270.361 ↑ 18,684.8 719 1

Merge Left Join (cost=401.38..2,915,378,384.59 rows=13,434,385 width=35) (actual time=5.802..270.361 rows=719 loops=1)

  • Merge Cond: (cli.id = cli_dom.cliente_id)
11. 57.433 266.217 ↑ 18,684.8 719 1

Nested Loop Left Join (cost=400.82..2,915,210,445.50 rows=13,434,385 width=35) (actual time=5.738..266.217 rows=719 loops=1)

  • Join Filter: (atcatcic.afip_tipo_condicion_iva_cliente_id = COALESCE(cli.t_condicion_iva_id, 5))
  • Rows Removed by Join Filter: 9,347
12. 0.857 13.935 ↑ 2,737.7 719 1

Nested Loop Left Join (cost=300.82..6,337,419.89 rows=1,968,408 width=35) (actual time=3.152..13.935 rows=719 loops=1)

  • Join Filter: (cli.t_condicion_iva_id = ati.id)
  • Rows Removed by Join Filter: 10,066
13. 2.016 11.640 ↑ 187.2 719 1

Nested Loop Left Join (cost=200.82..431,990.83 rows=134,592 width=35) (actual time=2.458..11.640 rows=719 loops=1)

  • Join Filter: (cli.t_documento_id = atd.id)
  • Rows Removed by Join Filter: 26,603
14. 1.714 6.748 ↑ 12.8 719 1

Nested Loop Left Join (cost=100.83..28,004.14 rows=9,203 width=39) (actual time=0.715..6.748 rows=719 loops=1)

  • Join Filter: (cli.vendedor_id = u_1.id)
  • Rows Removed by Join Filter: 21,568
15. 0.467 3.596 ↑ 1.0 719 1

Merge Left Join (cost=0.83..201.34 rows=719 width=47) (actual time=0.099..3.596 rows=719 loops=1)

  • Merge Cond: (cli.id = cli_dom_fis.cliente_id)
16. 1.623 1.623 ↑ 1.0 719 1

Index Scan using cliente_pkey on cliente cli (cost=0.28..86.06 rows=719 width=47) (actual time=0.035..1.623 rows=719 loops=1)

17. 0.206 1.506 ↓ 1.5 719 1

Materialize (cost=0.55..107.49 rows=479 width=8) (actual time=0.056..1.506 rows=719 loops=1)

18. 0.454 1.300 ↓ 1.5 719 1

Merge Anti Join (cost=0.55..106.30 rows=479 width=8) (actual time=0.053..1.300 rows=719 loops=1)

  • Merge Cond: (cli_dom_fis.cliente_id = cli_dom_fis2.cliente_id)
  • Join Filter: (cli_dom_fis2.id > cli_dom_fis.id)
  • Rows Removed by Join Filter: 720
19. 0.469 0.469 ↓ 1.0 720 1

Index Scan using cliente_domicilio_cliente_id_idx on cliente_domicilio cli_dom_fis (cost=0.28..46.86 rows=719 width=16) (actual time=0.016..0.469 rows=720 loops=1)

  • Filter: (t_domicilio_id = 1)
20. 0.377 0.377 ↓ 1.0 722 1

Index Scan using cliente_domicilio_cliente_id_idx on cliente_domicilio cli_dom_fis2 (cost=0.28..46.86 rows=719 width=16) (actual time=0.008..0.377 rows=722 loops=1)

  • Filter: (t_domicilio_id = 1)
21. 0.836 1.438 ↑ 85.3 30 719

Materialize (cost=100.00..199.60 rows=2,560 width=8) (actual time=0.001..0.002 rows=30 loops=719)

22. 0.602 0.602 ↑ 85.3 30 1

Foreign Scan on usuario u_1 (cost=100.00..186.80 rows=2,560 width=8) (actual time=0.599..0.602 rows=30 loops=1)

23. 1.149 2.876 ↑ 77.0 38 719

Materialize (cost=100.00..212.38 rows=2,925 width=4) (actual time=0.002..0.004 rows=38 loops=719)

24. 1.727 1.727 ↑ 77.0 38 1

Foreign Scan on afip_tipo_documento atd (cost=100.00..197.75 rows=2,925 width=4) (actual time=1.723..1.727 rows=38 loops=1)

25. 0.754 1.438 ↑ 195.0 15 719

Materialize (cost=100.00..212.38 rows=2,925 width=4) (actual time=0.001..0.002 rows=15 loops=719)

26. 0.684 0.684 ↑ 195.0 15 1

Foreign Scan on afip_tipo_condicion_iva ati (cost=100.00..197.75 rows=2,925 width=4) (actual time=0.682..0.684 rows=15 loops=1)

27. 0.447 2.157 ↑ 4.9 14 719

Materialize (cost=100.00..195.25 rows=68 width=40) (actual time=0.002..0.003 rows=14 loops=719)

28. 1.710 1.710 ↑ 4.9 14 1

Foreign Scan (cost=100.00..194.91 rows=68 width=40) (actual time=1.709..1.710 rows=14 loops=1)

  • Relations: (naxs_facturacion.afip_tipo_comprobante_afip_tipo_condicion_iva_cliente atcatcic) LEFT JOIN (naxs_facturacion.afip_tipo_comprobante atc)
29.          

SubPlan (for Nested Loop Left Join)

30. 192.692 192.692 ↑ 1.0 1 719

Foreign Scan on afip_tipo_comprobante atc2 (cost=100.00..216.38 rows=1 width=4) (actual time=0.266..0.268 rows=1 loops=719)

  • Filter: (""right""(btrim(upper(nombre)), 1) = ""right""(btrim(upper(atc.nombre)), 1))
  • Rows Removed by Filter: 4
31. 0.323 3.206 ↓ 1.5 719 1

Materialize (cost=0.55..103.90 rows=479 width=8) (actual time=0.051..3.206 rows=719 loops=1)

32. 0.600 2.883 ↓ 1.5 719 1

Merge Anti Join (cost=0.55..102.70 rows=479 width=8) (actual time=0.042..2.883 rows=719 loops=1)

  • Merge Cond: (cli_dom.cliente_id = cli_dom2.cliente_id)
  • Join Filter: (cli_dom2.id > cli_dom.id)
  • Rows Removed by Join Filter: 720
33. 1.183 1.183 ↓ 1.0 720 1

Index Scan using cliente_domicilio_cliente_id_idx on cliente_domicilio cli_dom (cost=0.28..45.06 rows=719 width=16) (actual time=0.022..1.183 rows=720 loops=1)

34. 1.100 1.100 ↓ 1.0 722 1

Index Scan using cliente_domicilio_cliente_id_idx on cliente_domicilio cli_dom2 (cost=0.28..45.06 rows=719 width=16) (actual time=0.008..1.100 rows=722 loops=1)

35. 0.157 0.664 ↓ 1.0 1,031 1

Hash (cost=59.57..59.57 rows=1,030 width=24) (actual time=0.664..0.664 rows=1,031 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 73kB
36. 0.507 0.507 ↓ 1.0 1,031 1

Seq Scan on cliente_recibo cr (cost=0.00..59.57 rows=1,030 width=24) (actual time=0.024..0.507 rows=1,031 loops=1)

  • Filter: activo
  • Rows Removed by Filter: 32
37. 0.113 7.766 ↑ 45.7 257 1

Hash (cost=487.85..487.85 rows=11,755 width=262) (actual time=7.766..7.766 rows=257 loops=1)

  • Buckets: 16,384 Batches: 1 Memory Usage: 183kB
38. 0.195 7.653 ↑ 45.7 257 1

Hash Right Join (cost=405.36..487.85 rows=11,755 width=262) (actual time=7.598..7.653 rows=257 loops=1)

  • Hash Cond: (popd.cheque_tercero_id = ct.id)
39. 0.488 3.672 ↓ 1.0 2,776 1

Hash Left Join (cost=97.14..158.94 rows=2,756 width=28) (actual time=2.121..3.672 rows=2,776 loops=1)

  • Hash Cond: (popd.proveedor_orden_pago_id = pop.id)
40. 1.154 1.154 ↓ 1.0 2,776 1

Seq Scan on proveedor_orden_pago_detalle popd (cost=0.00..54.56 rows=2,756 width=16) (actual time=0.069..1.154 rows=2,776 loops=1)

41. 0.407 2.030 ↓ 1.0 2,577 1

Hash (cost=65.35..65.35 rows=2,543 width=20) (actual time=2.030..2.030 rows=2,577 loops=1)

  • Buckets: 4,096 Batches: 1 Memory Usage: 173kB
42. 1.623 1.623 ↓ 1.0 2,577 1

Seq Scan on proveedor_orden_pago pop (cost=0.00..65.35 rows=2,543 width=20) (actual time=0.109..1.623 rows=2,577 loops=1)

  • Filter: (activo AND (anulada_usuario_id IS NULL))
  • Rows Removed by Filter: 72
43. 0.141 3.786 ↑ 4.1 257 1

Hash (cost=294.95..294.95 rows=1,062 width=242) (actual time=3.786..3.786 rows=257 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 71kB
44. 0.078 3.645 ↑ 4.1 257 1

Hash Left Join (cost=155.87..294.95 rows=1,062 width=242) (actual time=2.352..3.645 rows=257 loops=1)

  • Hash Cond: (ct.usuario_id = u.id)
45. 0.059 1.483 ↓ 1.0 257 1

Hash Left Join (cost=9.61..111.00 rows=249 width=178) (actual time=0.256..1.483 rows=257 loops=1)

  • Hash Cond: (ctd.banco_cuenta_id = bc.id)
46. 0.108 1.411 ↓ 1.0 257 1

Hash Left Join (cost=8.50..108.68 rows=249 width=177) (actual time=0.234..1.411 rows=257 loops=1)

  • Hash Cond: (ct.cheque_tercero_deposito_id = ctd.id)
47. 0.082 1.268 ↓ 1.0 257 1

Hash Left Join (cost=3.58..103.09 rows=249 width=161) (actual time=0.146..1.268 rows=257 loops=1)

  • Hash Cond: (ct.banco_id = b.id)
48. 0.425 1.157 ↓ 1.0 257 1

Hash Left Join (cost=1.11..99.93 rows=249 width=134) (actual time=0.107..1.157 rows=257 loops=1)

  • Hash Cond: (COALESCE((SubPlan 2), (ct.t_cheque_tercero_estado_id)::bigint) = tcte.id)
49. 0.188 0.188 ↓ 1.0 257 1

Seq Scan on cheque_tercero ct (cost=0.00..30.49 rows=249 width=112) (actual time=0.025..0.188 rows=257 loops=1)

50. 0.006 0.030 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=22) (actual time=0.030..0.030 rows=5 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
51. 0.024 0.024 ↑ 1.0 5 1

Seq Scan on t_cheque_tercero_estado tcte (cost=0.00..1.05 rows=5 width=22) (actual time=0.023..0.024 rows=5 loops=1)

52.          

SubPlan (for Hash Left Join)

53. 0.000 0.514 ↓ 0.0 0 514

Limit (cost=5.24..5.24 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=514)

54. 0.000 0.514 ↓ 0.0 0 514

Sort (cost=5.24..5.25 rows=4 width=16) (actual time=0.001..0.001 rows=0 loops=514)

  • Sort Key: cteh.id DESC
  • Sort Method: quicksort Memory: 25kB
55. 0.514 0.514 ↓ 0.0 0 514

Index Scan using cheque_tercero_estado_historial_cheque_tercero_id_idx on cheque_tercero_estado_historial cteh (cost=0.15..5.22 rows=4 width=16) (actual time=0.001..0.001 rows=0 loops=514)

  • Index Cond: (cheque_tercero_id = ct.id)
56. 0.014 0.029 ↑ 1.0 65 1

Hash (cost=1.65..1.65 rows=65 width=31) (actual time=0.029..0.029 rows=65 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
57. 0.015 0.015 ↑ 1.0 65 1

Seq Scan on banco b (cost=0.00..1.65 rows=65 width=31) (actual time=0.009..0.015 rows=65 loops=1)

58. 0.013 0.035 ↑ 1.9 67 1

Hash (cost=3.30..3.30 rows=130 width=24) (actual time=0.034..0.035 rows=67 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 12kB
59. 0.022 0.022 ↑ 1.9 67 1

Seq Scan on cheque_tercero_deposito ctd (cost=0.00..3.30 rows=130 width=24) (actual time=0.014..0.022 rows=67 loops=1)

  • Filter: activo
60. 0.004 0.013 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=17) (actual time=0.013..0.013 rows=5 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
61. 0.009 0.009 ↑ 1.0 5 1

Seq Scan on banco_cuenta bc (cost=0.00..1.05 rows=5 width=17) (actual time=0.008..0.009 rows=5 loops=1)

62. 0.010 2.084 ↑ 28.4 30 1

Hash (cost=135.59..135.59 rows=853 width=72) (actual time=2.084..2.084 rows=30 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
63. 2.074 2.074 ↑ 28.4 30 1

Foreign Scan on usuario u (cost=100.00..135.59 rows=853 width=72) (actual time=2.069..2.074 rows=30 loops=1)

64. 0.353 0.514 ↓ 2.0 16 257

Materialize (cost=0.42..16.06 rows=8 width=32) (actual time=0.000..0.002 rows=16 loops=257)

65. 0.017 0.161 ↓ 2.0 16 1

Nested Loop Left Join (cost=0.42..16.02 rows=8 width=32) (actual time=0.083..0.161 rows=16 loops=1)

66. 0.014 0.128 ↓ 2.0 16 1

Nested Loop Left Join (cost=0.14..10.39 rows=8 width=32) (actual time=0.070..0.128 rows=16 loops=1)

67. 0.018 0.018 ↓ 2.0 16 1

Seq Scan on cliente_devolucion_forma_detalle cdfd (cost=0.00..1.08 rows=8 width=16) (actual time=0.015..0.018 rows=16 loops=1)

68. 0.096 0.096 ↓ 0.0 0 16

Index Scan using cliente_devolucion_pkey on cliente_devolucion cd (cost=0.14..1.16 rows=1 width=24) (actual time=0.006..0.006 rows=0 loops=16)

  • Index Cond: (id = cdfd.cliente_devolucion_id)
  • Filter: activo
  • Rows Removed by Filter: 0
69. 0.016 0.016 ↓ 0.0 0 16

Index Scan using persona_recibo_pkey on cliente_recibo crdc (cost=0.28..0.70 rows=1 width=8) (actual time=0.001..0.001 rows=0 loops=16)

  • Index Cond: (id = cd.cliente_recibo_id)
  • Filter: activo
70. 0.115 1.041 ↑ 1.0 479 1

Hash (cost=37.79..37.79 rows=479 width=47) (actual time=1.041..1.041 rows=479 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 47kB
71. 0.926 0.926 ↑ 1.0 479 1

Seq Scan on proveedor p (cost=0.00..37.79 rows=479 width=47) (actual time=0.040..0.926 rows=479 loops=1)

72. 0.012 0.029 ↑ 425.0 2 1

Hash (cost=18.50..18.50 rows=850 width=36) (actual time=0.029..0.029 rows=2 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
73. 0.017 0.017 ↑ 425.0 2 1

Seq Scan on t_cheque_tipo tct (cost=0.00..18.50 rows=850 width=36) (actual time=0.016..0.017 rows=2 loops=1)

74. 0.000 0.000 ↑ 1.0 5 257

Materialize (cost=0.00..1.07 rows=5 width=17) (actual time=0.000..0.000 rows=5 loops=257)

75. 0.012 0.012 ↑ 1.0 5 1

Seq Scan on banco_cuenta bce (cost=0.00..1.05 rows=5 width=17) (actual time=0.010..0.012 rows=5 loops=1)

Execution time : 2,603.158 ms