explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FRv2

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Limit (cost=3,051,871,134.88..3,051,871,143.38 rows=100 width=457) (actual rows= loops=)

  • Functions: 181
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
2. 0.000 0.000 ↓ 0.0

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

3. 0.000 0.000 ↓ 0.0

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

  • 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
4. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (ct.banco_cuenta_id = bce.id)
5. 0.000 0.000 ↓ 0.0

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

  • Hash Cond: (ct.t_cheque_tipo_id = tct.id)
6. 0.000 0.000 ↓ 0.0

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

  • Hash Cond: (pop.proveedor_id = p.id)
7. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (ct.id = cdfd.cheque_tercero_id)
8. 0.000 0.000 ↓ 0.0

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

  • Hash Cond: (cr.id = ct.cliente_recibo_id)
9. 0.000 0.000 ↓ 0.0

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

  • Hash Cond: (cli.id = cr.cliente_id)
10. 0.000 0.000 ↓ 0.0

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

  • Merge Cond: (cli.id = cli_dom.cliente_id)
11. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (atcatcic.afip_tipo_condicion_iva_cliente_id = COALESCE(cli.t_condicion_iva_id, 5))
12. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (cli.t_condicion_iva_id = ati.id)
13. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (cli.t_documento_id = atd.id)
14. 0.000 0.000 ↓ 0.0

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

  • Join Filter: (cli.vendedor_id = u_1.id)
15. 0.000 0.000 ↓ 0.0

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

  • Merge Cond: (cli.id = cli_dom_fis.cliente_id)
16. 0.000 0.000 ↓ 0.0

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

17. 0.000 0.000 ↓ 0.0

Materialize (cost=0.55..107.49 rows=479 width=8) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Merge Anti Join (cost=0.55..106.30 rows=479 width=8) (actual rows= loops=)

  • Merge Cond: (cli_dom_fis.cliente_id = cli_dom_fis2.cliente_id)
  • Join Filter: (cli_dom_fis2.id > cli_dom_fis.id)
19. 0.000 0.000 ↓ 0.0

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

  • Filter: (t_domicilio_id = 1)
20. 0.000 0.000 ↓ 0.0

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

  • Filter: (t_domicilio_id = 1)
21. 0.000 0.000 ↓ 0.0

Materialize (cost=100.00..199.60 rows=2,560 width=8) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

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

23. 0.000 0.000 ↓ 0.0

Materialize (cost=100.00..212.38 rows=2,925 width=4) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

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

25. 0.000 0.000 ↓ 0.0

Materialize (cost=100.00..212.38 rows=2,925 width=4) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

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

27. 0.000 0.000 ↓ 0.0

Materialize (cost=100.00..195.25 rows=68 width=40) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Foreign Scan (cost=100.00..194.91 rows=68 width=40) (actual rows= loops=)

  • 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. 0.000 0.000 ↓ 0.0

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

  • Filter: (""right""(btrim(upper(nombre)), 1) = ""right""(btrim(upper(atc.nombre)), 1))
31. 0.000 0.000 ↓ 0.0

Materialize (cost=0.55..103.90 rows=479 width=8) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Merge Anti Join (cost=0.55..102.70 rows=479 width=8) (actual rows= loops=)

  • Merge Cond: (cli_dom.cliente_id = cli_dom2.cliente_id)
  • Join Filter: (cli_dom2.id > cli_dom.id)
33. 0.000 0.000 ↓ 0.0

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

34. 0.000 0.000 ↓ 0.0

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

35. 0.000 0.000 ↓ 0.0

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

36. 0.000 0.000 ↓ 0.0

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

  • Filter: activo
37. 0.000 0.000 ↓ 0.0

Hash (cost=487.85..487.85 rows=11,755 width=262) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Hash Right Join (cost=405.36..487.85 rows=11,755 width=262) (actual rows= loops=)

  • Hash Cond: (popd.cheque_tercero_id = ct.id)
39. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=97.14..158.94 rows=2,756 width=28) (actual rows= loops=)

  • Hash Cond: (popd.proveedor_orden_pago_id = pop.id)
40. 0.000 0.000 ↓ 0.0

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

41. 0.000 0.000 ↓ 0.0

Hash (cost=65.35..65.35 rows=2,543 width=20) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

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

  • Filter: (activo AND (anulada_usuario_id IS NULL))
43. 0.000 0.000 ↓ 0.0

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

44. 0.000 0.000 ↓ 0.0

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

  • Hash Cond: (ct.usuario_id = u.id)
45. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9.61..111.00 rows=249 width=178) (actual rows= loops=)

  • Hash Cond: (ctd.banco_cuenta_id = bc.id)
46. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=8.50..108.68 rows=249 width=177) (actual rows= loops=)

  • Hash Cond: (ct.cheque_tercero_deposito_id = ctd.id)
47. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=3.58..103.09 rows=249 width=161) (actual rows= loops=)

  • Hash Cond: (ct.banco_id = b.id)
48. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=1.11..99.93 rows=249 width=134) (actual rows= loops=)

  • Hash Cond: (COALESCE((SubPlan 2), (ct.t_cheque_tercero_estado_id)::bigint) = tcte.id)
49. 0.000 0.000 ↓ 0.0

Seq Scan on cheque_tercero ct (cost=0.00..30.49 rows=249 width=112) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

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

51. 0.000 0.000 ↓ 0.0

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

52.          

SubPlan (for Hash Left Join)

53. 0.000 0.000 ↓ 0.0

Limit (cost=5.24..5.24 rows=1 width=16) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Sort (cost=5.24..5.25 rows=4 width=16) (actual rows= loops=)

  • Sort Key: cteh.id DESC
55. 0.000 0.000 ↓ 0.0

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 rows= loops=)

  • Index Cond: (cheque_tercero_id = ct.id)
56. 0.000 0.000 ↓ 0.0

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

57. 0.000 0.000 ↓ 0.0

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

58. 0.000 0.000 ↓ 0.0

Hash (cost=3.30..3.30 rows=130 width=24) (actual rows= loops=)

59. 0.000 0.000 ↓ 0.0

Seq Scan on cheque_tercero_deposito ctd (cost=0.00..3.30 rows=130 width=24) (actual rows= loops=)

  • Filter: activo
60. 0.000 0.000 ↓ 0.0

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

61. 0.000 0.000 ↓ 0.0

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

62. 0.000 0.000 ↓ 0.0

Hash (cost=135.59..135.59 rows=853 width=72) (actual rows= loops=)

63. 0.000 0.000 ↓ 0.0

Foreign Scan on usuario u (cost=100.00..135.59 rows=853 width=72) (actual rows= loops=)

64. 0.000 0.000 ↓ 0.0

Materialize (cost=0.42..16.06 rows=8 width=32) (actual rows= loops=)

65. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.42..16.02 rows=8 width=32) (actual rows= loops=)

66. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=0.14..10.39 rows=8 width=32) (actual rows= loops=)

67. 0.000 0.000 ↓ 0.0

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

68. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = cdfd.cliente_devolucion_id)
  • Filter: activo
69. 0.000 0.000 ↓ 0.0

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

  • Index Cond: (id = cd.cliente_recibo_id)
  • Filter: activo
70. 0.000 0.000 ↓ 0.0

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

71. 0.000 0.000 ↓ 0.0

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

72. 0.000 0.000 ↓ 0.0

Hash (cost=18.50..18.50 rows=850 width=36) (actual rows= loops=)

73. 0.000 0.000 ↓ 0.0

Seq Scan on t_cheque_tipo tct (cost=0.00..18.50 rows=850 width=36) (actual rows= loops=)

74. 0.000 0.000 ↓ 0.0

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

  • -> Seq Scan on banco_cuenta bce (cost=0.00..1.05 rows=5 width=17)JIT: