explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1ZOm

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.016 54.266 ↓ 6.5 13 1

Limit (cost=94,926.04..94,926.04 rows=2 width=96) (actual time=54.255..54.266 rows=13 loops=1)

2.          

Initplan (forLimit)

3. 0.017 10.126 ↑ 1.0 1 1

Subquery Scan on t1 (cost=1,832.53..1,832.56 rows=1 width=4) (actual time=10.125..10.126 rows=1 loops=1)

4. 0.008 10.109 ↑ 1.0 1 1

Aggregate (cost=1,832.53..1,832.54 rows=1 width=8) (actual time=10.109..10.109 rows=1 loops=1)

5. 0.018 10.101 ↑ 1.5 53 1

Unique (cost=1,831.16..1,831.55 rows=78 width=4) (actual time=10.073..10.101 rows=53 loops=1)

6. 0.055 10.083 ↓ 1.5 119 1

Sort (cost=1,831.16..1,831.36 rows=78 width=4) (actual time=10.072..10.083 rows=119 loops=1)

  • Sort Key: cfa_1.cli_id
  • Sort Method: quicksort Memory: 30kB
7. 0.089 10.028 ↓ 1.5 119 1

Nested Loop (cost=0.42..1,828.71 rows=78 width=4) (actual time=1.340..10.028 rows=119 loops=1)

8. 9.582 9.582 ↑ 1.0 119 1

Seq Scan on cfactura cfa_1 (cost=0.00..1,526.80 rows=122 width=20) (actual time=1.321..9.582 rows=119 loops=1)

  • Filter: ((cti_id = 20) AND (date(cfa_fecha) = '2019-01-07'::date))
  • Rows Removed by Filter: 31150
9. 0.357 0.357 ↑ 1.0 1 119

Index Scan using ccomproba_uk_llave on ccomproba ccm_1 (cost=0.42..2.46 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=119)

  • Index Cond: ((ccm_periodo = cfa_1.cfa_periodo) AND (cti_id = 20) AND (pve_id = cfa_1.pve_id) AND (ccm_numero = cfa_1.cfa_numero))
  • Filter: (ccm_estado = 2)
10. 0.071 44.124 ↑ 1.8 13 1

Sort (cost=93,093.48..93,093.54 rows=24 width=96) (actual time=44.124..44.124 rows=13 loops=1)

  • Sort Key: (random())
  • Sort Method: top-N heapsort Memory: 26kB
11. 0.044 44.053 ↓ 2.2 53 1

Subquery Scan on tt (cost=3,792.12..93,092.93 rows=24 width=96) (actual time=37.789..44.053 rows=53 loops=1)

12. 0.173 44.009 ↓ 2.2 53 1

Group (cost=3,792.12..93,092.63 rows=24 width=88) (actual time=37.787..44.009 rows=53 loops=1)

  • Group Key: cli.cli_id, tlf.tel_id
13.          

Initplan (forGroup)

14. 0.013 9.211 ↑ 1.0 1 1

Subquery Scan on t1_1 (cost=1,832.53..1,832.56 rows=1 width=4) (actual time=9.211..9.211 rows=1 loops=1)

15. 0.005 9.198 ↑ 1.0 1 1

Aggregate (cost=1,832.53..1,832.54 rows=1 width=8) (actual time=9.198..9.198 rows=1 loops=1)

16. 0.025 9.193 ↑ 1.5 53 1

Unique (cost=1,831.16..1,831.55 rows=78 width=4) (actual time=9.164..9.193 rows=53 loops=1)

17. 0.064 9.168 ↓ 1.5 119 1

Sort (cost=1,831.16..1,831.36 rows=78 width=4) (actual time=9.157..9.168 rows=119 loops=1)

  • Sort Key: cfa_6.cli_id
  • Sort Method: quicksort Memory: 30kB
18. 0.093 9.104 ↓ 1.5 119 1

Nested Loop (cost=0.42..1,828.71 rows=78 width=4) (actual time=1.198..9.104 rows=119 loops=1)

19. 8.654 8.654 ↑ 1.0 119 1

Seq Scan on cfactura cfa_6 (cost=0.00..1,526.80 rows=122 width=20) (actual time=1.186..8.654 rows=119 loops=1)

  • Filter: ((cti_id = 20) AND (date(cfa_fecha) = '2019-01-07'::date))
  • Rows Removed by Filter: 31150
20. 0.357 0.357 ↑ 1.0 1 119

Index Scan using ccomproba_uk_llave on ccomproba ccm_4 (cost=0.42..2.46 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=119)

  • Index Cond: ((ccm_periodo = cfa_6.cfa_periodo) AND (cti_id = 20) AND (pve_id = cfa_6.pve_id) AND (ccm_numero = cfa_6.cfa_numero))
  • Filter: (ccm_estado = 2)
21. 0.051 9.662 ↓ 2.2 53 1

Sort (cost=1,959.56..1,959.62 rows=24 width=20) (actual time=9.650..9.662 rows=53 loops=1)

  • Sort Key: cli.cli_id, tlf.tel_id
  • Sort Method: quicksort Memory: 29kB
22. 0.011 9.611 ↓ 2.2 53 1

Nested Loop Left Join (cost=1,832.01..1,959.01 rows=24 width=20) (actual time=9.087..9.611 rows=53 loops=1)

23. 0.002 9.441 ↓ 2.2 53 1

Nested Loop Left Join (cost=1,831.73..1,951.33 rows=24 width=20) (actual time=9.073..9.441 rows=53 loops=1)

24. 0.029 9.280 ↓ 2.2 53 1

Nested Loop (cost=1,831.44..1,942.51 rows=24 width=20) (actual time=9.066..9.280 rows=53 loops=1)

25. 0.022 9.092 ↑ 1.5 53 1

Unique (cost=1,831.16..1,831.55 rows=78 width=4) (actual time=9.056..9.092 rows=53 loops=1)

26. 0.062 9.070 ↓ 1.5 119 1

Sort (cost=1,831.16..1,831.36 rows=78 width=4) (actual time=9.055..9.070 rows=119 loops=1)

  • Sort Key: cfa.cli_id
  • Sort Method: quicksort Memory: 30kB
27. 0.079 9.008 ↓ 1.5 119 1

Nested Loop (cost=0.42..1,828.71 rows=78 width=4) (actual time=1.227..9.008 rows=119 loops=1)

28. 8.572 8.572 ↑ 1.0 119 1

Seq Scan on cfactura cfa (cost=0.00..1,526.80 rows=122 width=20) (actual time=1.213..8.572 rows=119 loops=1)

  • Filter: ((cti_id = 20) AND (date(cfa_fecha) = '2019-01-07'::date))
  • Rows Removed by Filter: 31150
29. 0.357 0.357 ↑ 1.0 1 119

Index Scan using ccomproba_uk_llave on ccomproba ccm (cost=0.42..2.46 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=119)

  • Index Cond: ((ccm_periodo = cfa.cfa_periodo) AND (cti_id = 20) AND (pve_id = cfa.pve_id) AND (ccm_numero = cfa.cfa_numero))
  • Filter: (ccm_estado = 2)
30. 0.159 0.159 ↑ 1.0 1 53

Index Scan using cliente_pkey on cliente cli (cost=0.28..1.40 rows=1 width=20) (actual time=0.003..0.003 rows=1 loops=53)

  • Index Cond: (cli_id = cfa.cli_id)
  • Filter: (cli_tipocli = 1)
31. 0.159 0.159 ↑ 1.0 1 53

Index Scan using pk_entidad on entidad ent (cost=0.28..0.36 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=53)

  • Index Cond: (ent_id = cli.ent_id)
32. 0.159 0.159 ↑ 1.0 1 53

Index Only Scan using pk_telefono on telefono tlf (cost=0.28..0.31 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=53)

  • Index Cond: (tel_id = ent.ent_telefono_principal)
  • Heap Fetches: 53
33.          

SubPlan (forGroup)

34. 0.159 12.402 ↑ 1.0 1 53

Aggregate (cost=1,859.33..1,859.34 rows=1 width=32) (actual time=0.234..0.234 rows=1 loops=53)

35. 0.571 12.243 ↓ 2.0 2 53

Hash Semi Join (cost=1,833.59..1,859.32 rows=1 width=4) (actual time=0.229..0.231 rows=2 loops=53)

  • Hash Cond: (cfa_2.cfa_id = cfa_3.cfa_id)
36. 2.226 2.226 ↓ 3.5 77 53

Index Scan using cfactura_llave_idx1 on cfactura cfa_2 (cost=0.29..25.95 rows=22 width=8) (actual time=0.005..0.042 rows=77 loops=53)

  • Index Cond: (cli_id = cli.cli_id)
37. 0.033 9.446 ↓ 1.5 119 1

Hash (cost=1,832.33..1,832.33 rows=78 width=4) (actual time=9.446..9.446 rows=119 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
38. 0.023 9.413 ↓ 1.5 119 1

Unique (cost=1,831.16..1,831.55 rows=78 width=4) (actual time=9.380..9.413 rows=119 loops=1)

39. 0.070 9.390 ↓ 1.5 119 1

Sort (cost=1,831.16..1,831.36 rows=78 width=4) (actual time=9.379..9.390 rows=119 loops=1)

  • Sort Key: cfa_3.cfa_id
  • Sort Method: quicksort Memory: 30kB
40. 0.069 9.320 ↓ 1.5 119 1

Nested Loop (cost=0.42..1,828.71 rows=78 width=4) (actual time=1.225..9.320 rows=119 loops=1)

41. 8.894 8.894 ↑ 1.0 119 1

Seq Scan on cfactura cfa_3 (cost=0.00..1,526.80 rows=122 width=20) (actual time=1.213..8.894 rows=119 loops=1)

  • Filter: ((cti_id = 20) AND (date(cfa_fecha) = '2019-01-07'::date))
  • Rows Removed by Filter: 31150
42. 0.357 0.357 ↑ 1.0 1 119

Index Scan using ccomproba_uk_llave on ccomproba ccm_2 (cost=0.42..2.46 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=119)

  • Index Cond: ((ccm_periodo = cfa_3.cfa_periodo) AND (cti_id = 20) AND (pve_id = cfa_3.pve_id) AND (ccm_numero = cfa_3.cfa_numero))
  • Filter: (ccm_estado = 2)
43. 0.106 12.561 ↑ 1.0 1 53

Aggregate (cost=1,861.50..1,861.51 rows=1 width=32) (actual time=0.237..0.237 rows=1 loops=53)

44. 0.108 12.455 ↓ 2.0 2 53

Nested Loop (cost=1,834.17..1,861.49 rows=1 width=4) (actual time=0.226..0.235 rows=2 loops=53)

45. 0.133 12.137 ↓ 2.0 2 53

Nested Loop (cost=1,833.88..1,861.14 rows=1 width=4) (actual time=0.223..0.229 rows=2 loops=53)

  • Join Filter: (cfa_4.cfa_id = dgui.cfa_id)
46. 0.637 11.766 ↓ 2.0 2 53

Hash Semi Join (cost=1,833.59..1,859.32 rows=1 width=8) (actual time=0.220..0.222 rows=2 loops=53)

  • Hash Cond: (cfa_4.cfa_id = cfa_5.cfa_id)
47. 1.802 1.802 ↓ 3.5 77 53

Index Scan using cfactura_llave_idx1 on cfactura cfa_4 (cost=0.29..25.95 rows=22 width=4) (actual time=0.004..0.034 rows=77 loops=53)

  • Index Cond: (cli_id = cli.cli_id)
48. 0.034 9.327 ↓ 1.5 119 1

Hash (cost=1,832.33..1,832.33 rows=78 width=4) (actual time=9.327..9.327 rows=119 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
49. 0.021 9.293 ↓ 1.5 119 1

Unique (cost=1,831.16..1,831.55 rows=78 width=4) (actual time=9.261..9.293 rows=119 loops=1)

50. 0.065 9.272 ↓ 1.5 119 1

Sort (cost=1,831.16..1,831.36 rows=78 width=4) (actual time=9.261..9.272 rows=119 loops=1)

  • Sort Key: cfa_5.cfa_id
  • Sort Method: quicksort Memory: 30kB
51. 0.082 9.207 ↓ 1.5 119 1

Nested Loop (cost=0.42..1,828.71 rows=78 width=4) (actual time=1.241..9.207 rows=119 loops=1)

52. 8.768 8.768 ↑ 1.0 119 1

Seq Scan on cfactura cfa_5 (cost=0.00..1,526.80 rows=122 width=20) (actual time=1.228..8.768 rows=119 loops=1)

  • Filter: ((cti_id = 20) AND (date(cfa_fecha) = '2019-01-07'::date))
  • Rows Removed by Filter: 31150
53. 0.357 0.357 ↑ 1.0 1 119

Index Scan using ccomproba_uk_llave on ccomproba ccm_3 (cost=0.42..2.46 rows=1 width=16) (actual time=0.003..0.003 rows=1 loops=119)

  • Index Cond: ((ccm_periodo = cfa_5.cfa_periodo) AND (cti_id = 20) AND (pve_id = cfa_5.pve_id) AND (ccm_numero = cfa_5.cfa_numero))
  • Filter: (ccm_estado = 2)
54. 0.238 0.238 ↑ 1.0 1 119

Index Scan using dguiarem_llave_cfactura on dguiarem dgui (cost=0.29..1.81 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=119)

  • Index Cond: (cfa_id = cfa_5.cfa_id)
55. 0.210 0.210 ↑ 1.0 1 105

Index Scan using cguiarem_pkey on cguiarem cgui (cost=0.29..0.34 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=105)

  • Index Cond: (cgui_id = dgui.cgui_id)