explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kKpv

Settings
# exclusive inclusive rows x rows loops node
1. 0.101 13.430 ↑ 1.0 1 1

Nested Loop Left Join (cost=16.74..45,767.67 rows=1 width=387) (actual time=13.418..13.430 rows=1 loops=1)

  • Join Filter: (cte.id = orders.klass)
  • Rows Removed by Join Filter: 18
2.          

CTE cte

3. 0.017 0.017 ↑ 1.0 19 1

Seq Scan on tarifi (cost=0.00..6.19 rows=19 width=7) (actual time=0.003..0.017 rows=19 loops=1)

4.          

Initplan (for Nested Loop Left Join)

5. 0.000 0.000 ↓ 0.0 0

Index Scan using opt_opt_key on opt (cost=0.28..8.29 rows=1 width=16) (never executed)

  • Index Cond: ((opt)::text = 'order_creating_over'::text)
6. 0.002 0.037 ↑ 1.0 1 1

Nested Loop Left Join (cost=2.26..39.26 rows=1 width=371) (actual time=0.030..0.037 rows=1 loops=1)

7. 0.000 0.028 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.85..34.05 rows=1 width=318) (actual time=0.024..0.028 rows=1 loops=1)

8. 0.003 0.023 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.56..33.66 rows=1 width=286) (actual time=0.020..0.023 rows=1 loops=1)

9. 0.002 0.016 ↑ 1.0 1 1

Nested Loop Left Join (cost=1.27..25.35 rows=1 width=239) (actual time=0.014..0.016 rows=1 loops=1)

10. 0.005 0.014 ↑ 1.0 1 1

Nested Loop (cost=1.12..17.17 rows=1 width=211) (actual time=0.013..0.014 rows=1 loops=1)

11. 0.007 0.007 ↑ 1.0 1 1

Index Scan using orders_id_pk on orders orders_1 (cost=0.56..8.58 rows=1 width=141) (actual time=0.007..0.007 rows=1 loops=1)

  • Index Cond: (id = 22204667)
12. 0.002 0.002 ↑ 1.0 1 1

Index Scan using orders_id_pk on orders (cost=0.56..8.58 rows=1 width=74) (actual time=0.001..0.002 rows=1 loops=1)

  • Index Cond: (id = 22204667)
13. 0.000 0.000 ↓ 0.0 0 1

Index Scan using client_podarok_kod_pkey on client_podarok_kod (cost=0.15..8.17 rows=1 width=36) (actual time=0.000..0.000 rows=0 loops=1)

  • Index Cond: (id = orders.id_podarka)
14. 0.004 0.004 ↑ 1.0 1 1

Index Scan using bort_id_pk on bort (cost=0.29..8.30 rows=1 width=51) (actual time=0.003..0.004 rows=1 loops=1)

  • Index Cond: (id = COALESCE(CASE WHEN (orders.id_bort > 0) THEN orders.id_bort ELSE NULL::integer END, orders.id_bort_vzyal))
15. 0.005 0.005 ↑ 1.0 1 1

Index Scan using car_id_pk on car (cost=0.29..0.38 rows=1 width=44) (actual time=0.004..0.005 rows=1 loops=1)

  • Index Cond: (id = bort.id_car)
16. 0.007 0.007 ↑ 1.0 1 1

Index Scan using driver_id_pk on driver (cost=0.41..5.20 rows=1 width=61) (actual time=0.005..0.007 rows=1 loops=1)

  • Index Cond: (id = bort.id_driver)
17. 0.020 0.020 ↑ 1.0 19 1

CTE Scan on cte (cost=0.00..0.38 rows=19 width=20) (actual time=0.004..0.020 rows=19 loops=1)

18.          

SubPlan (for Nested Loop Left Join)

19. 0.004 4.003 ↑ 1.0 1 1

Subquery Scan on bort_s_klientom (cost=1.41..22,854.92 rows=1 width=4) (actual time=4.003..4.003 rows=1 loops=1)

  • Filter: (orders_1.id = bort_s_klientom.id_order)
  • Rows Removed by Filter: 25
20. 0.072 3.999 ↑ 10.5 26 1

HashSetOp Except (cost=1.41..22,851.52 rows=272 width=8) (actual time=3.996..3.999 rows=26 loops=1)

21. 0.024 3.927 ↓ 1.0 406 1

Append (cost=1.41..22,849.49 rows=405 width=8) (actual time=0.083..3.927 rows=406 loops=1)

22. 0.041 2.243 ↓ 1.2 326 1

Subquery Scan on "*SELECT* 1" (cost=1.41..11,428.59 rows=272 width=8) (actual time=0.082..2.243 rows=326 loops=1)

23. 0.000 2.202 ↓ 1.2 326 1

Nested Loop (cost=1.41..11,425.87 rows=272 width=8) (actual time=0.081..2.202 rows=326 loops=1)

24. 0.145 1.470 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.075..1.470 rows=244 loops=1)

25. 0.795 0.795 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_2 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.010..0.795 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
26. 0.530 0.530 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_1 (cost=0.29..1.65 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=265)

  • Index Cond: (id = orders_2.id_bort)
  • Heap Fetches: 229
27. 0.732 0.732 ↑ 2.0 1 244

Index Scan using tochki_idx on tochki (cost=0.56..13.89 rows=2 width=4) (actual time=0.002..0.003 rows=1 loops=244)

  • Index Cond: (id_order = orders_2.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL))
  • Rows Removed by Filter: 1
28. 0.008 1.660 ↑ 1.7 80 1

Subquery Scan on "*SELECT* 2" (cost=1.41..11,420.90 rows=133 width=8) (actual time=0.055..1.660 rows=80 loops=1)

29. 0.086 1.652 ↑ 1.7 80 1

Nested Loop (cost=1.41..11,419.57 rows=133 width=8) (actual time=0.055..1.652 rows=80 loops=1)

30. 0.000 1.078 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.051..1.078 rows=244 loops=1)

31. 0.586 0.586 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_3 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.008..0.586 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
32. 0.530 0.530 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_2 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=265)

  • Index Cond: (id = orders_3.id_bort)
  • Heap Fetches: 227
33. 0.488 0.488 ↓ 0.0 0 244

Index Scan using tochki_idx on tochki tochki_1 (cost=0.56..13.89 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=244)

  • Index Cond: (id_order = orders_3.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL) AND pervaya)
  • Rows Removed by Filter: 2
34. 0.005 3.206 ↑ 1.0 1 1

Subquery Scan on bort_s_klientom_1 (cost=1.41..22,854.92 rows=1 width=4) (actual time=3.206..3.206 rows=1 loops=1)

  • Filter: (orders_1.id = bort_s_klientom_1.id_order)
  • Rows Removed by Filter: 25
35. 0.076 3.201 ↑ 10.5 26 1

HashSetOp Except (cost=1.41..22,851.52 rows=272 width=8) (actual time=3.199..3.201 rows=26 loops=1)

36. 0.025 3.125 ↓ 1.0 406 1

Append (cost=1.41..22,849.49 rows=405 width=8) (actual time=0.048..3.125 rows=406 loops=1)

37. 0.037 1.566 ↓ 1.2 326 1

Subquery Scan on "*SELECT* 1_1" (cost=1.41..11,428.59 rows=272 width=8) (actual time=0.048..1.566 rows=326 loops=1)

38. 0.085 1.529 ↓ 1.2 326 1

Nested Loop (cost=1.41..11,425.87 rows=272 width=8) (actual time=0.047..1.529 rows=326 loops=1)

39. 0.160 0.956 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.042..0.956 rows=244 loops=1)

40. 0.531 0.531 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_4 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.006..0.531 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
41. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_3 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_4.id_bort)
  • Heap Fetches: 227
42. 0.488 0.488 ↑ 2.0 1 244

Index Scan using tochki_idx on tochki tochki_2 (cost=0.56..13.89 rows=2 width=4) (actual time=0.002..0.002 rows=1 loops=244)

  • Index Cond: (id_order = orders_4.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL))
  • Rows Removed by Filter: 1
43. 0.014 1.534 ↑ 1.7 80 1

Subquery Scan on "*SELECT* 2_1" (cost=1.41..11,420.90 rows=133 width=8) (actual time=0.053..1.534 rows=80 loops=1)

44. 0.110 1.520 ↑ 1.7 80 1

Nested Loop (cost=1.41..11,419.57 rows=133 width=8) (actual time=0.051..1.520 rows=80 loops=1)

45. 0.161 0.922 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.048..0.922 rows=244 loops=1)

46. 0.496 0.496 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_5 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.006..0.496 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
47. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_4 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_5.id_bort)
  • Heap Fetches: 227
48. 0.488 0.488 ↓ 0.0 0 244

Index Scan using tochki_idx on tochki tochki_3 (cost=0.56..13.89 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=244)

  • Index Cond: (id_order = orders_5.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL) AND pervaya)
  • Rows Removed by Filter: 2
49. 0.003 3.192 ↑ 1.0 1 1

Subquery Scan on bort_s_klientom_2 (cost=1.41..22,854.92 rows=1 width=4) (actual time=3.192..3.192 rows=1 loops=1)

  • Filter: (orders_1.id = bort_s_klientom_2.id_order)
  • Rows Removed by Filter: 25
50. 0.101 3.189 ↑ 10.5 26 1

HashSetOp Except (cost=1.41..22,851.52 rows=272 width=8) (actual time=3.185..3.189 rows=26 loops=1)

51. 0.033 3.088 ↓ 1.0 406 1

Append (cost=1.41..22,849.49 rows=405 width=8) (actual time=0.045..3.088 rows=406 loops=1)

52. 0.040 1.586 ↓ 1.2 326 1

Subquery Scan on "*SELECT* 1_2" (cost=1.41..11,428.59 rows=272 width=8) (actual time=0.045..1.586 rows=326 loops=1)

53. 0.118 1.546 ↓ 1.2 326 1

Nested Loop (cost=1.41..11,425.87 rows=272 width=8) (actual time=0.044..1.546 rows=326 loops=1)

54. 0.150 0.940 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.040..0.940 rows=244 loops=1)

55. 0.525 0.525 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_6 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.005..0.525 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
56. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_5 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_6.id_bort)
  • Heap Fetches: 227
57. 0.488 0.488 ↑ 2.0 1 244

Index Scan using tochki_idx on tochki tochki_4 (cost=0.56..13.89 rows=2 width=4) (actual time=0.002..0.002 rows=1 loops=244)

  • Index Cond: (id_order = orders_6.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL))
  • Rows Removed by Filter: 1
58. 0.005 1.469 ↑ 1.7 80 1

Subquery Scan on "*SELECT* 2_2" (cost=1.41..11,420.90 rows=133 width=8) (actual time=0.050..1.469 rows=80 loops=1)

59. 0.072 1.464 ↑ 1.7 80 1

Nested Loop (cost=1.41..11,419.57 rows=133 width=8) (actual time=0.049..1.464 rows=80 loops=1)

60. 0.178 0.904 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.044..0.904 rows=244 loops=1)

61. 0.461 0.461 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_7 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.006..0.461 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
62. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_6 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_7.id_bort)
  • Heap Fetches: 227
63. 0.488 0.488 ↓ 0.0 0 244

Index Scan using tochki_idx on tochki tochki_5 (cost=0.56..13.89 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=244)

  • Index Cond: (id_order = orders_7.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL) AND pervaya)
  • Rows Removed by Filter: 2
64. 0.003 2.871 ↑ 1.0 1 1

Subquery Scan on bort_s_klientom_3 (cost=1.41..22,854.92 rows=1 width=4) (actual time=2.871..2.871 rows=1 loops=1)

  • Filter: (orders_1.id = bort_s_klientom_3.id_order)
  • Rows Removed by Filter: 25
65. 0.083 2.868 ↑ 10.5 26 1

HashSetOp Except (cost=1.41..22,851.52 rows=272 width=8) (actual time=2.865..2.868 rows=26 loops=1)

66. 0.025 2.785 ↓ 1.0 406 1

Append (cost=1.41..22,849.49 rows=405 width=8) (actual time=0.049..2.785 rows=406 loops=1)

67. 0.020 1.422 ↓ 1.2 326 1

Subquery Scan on "*SELECT* 1_3" (cost=1.41..11,428.59 rows=272 width=8) (actual time=0.049..1.422 rows=326 loops=1)

68. 0.041 1.402 ↓ 1.2 326 1

Nested Loop (cost=1.41..11,425.87 rows=272 width=8) (actual time=0.049..1.402 rows=326 loops=1)

69. 0.133 0.873 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.044..0.873 rows=244 loops=1)

70. 0.475 0.475 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_8 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.007..0.475 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
71. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_7 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_8.id_bort)
  • Heap Fetches: 227
72. 0.488 0.488 ↑ 2.0 1 244

Index Scan using tochki_idx on tochki tochki_6 (cost=0.56..13.89 rows=2 width=4) (actual time=0.002..0.002 rows=1 loops=244)

  • Index Cond: (id_order = orders_8.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL))
  • Rows Removed by Filter: 1
73. 0.010 1.338 ↑ 1.7 80 1

Subquery Scan on "*SELECT* 2_3" (cost=1.41..11,420.90 rows=133 width=8) (actual time=0.045..1.338 rows=80 loops=1)

74. 0.023 1.328 ↑ 1.7 80 1

Nested Loop (cost=1.41..11,419.57 rows=133 width=8) (actual time=0.043..1.328 rows=80 loops=1)

75. 0.120 0.817 ↑ 2.6 244 1

Nested Loop (cost=0.85..2,663.04 rows=630 width=8) (actual time=0.039..0.817 rows=244 loops=1)

76. 0.432 0.432 ↑ 2.8 265 1

Index Scan using orders_idx22 on orders orders_9 (cost=0.56..1,440.42 rows=738 width=8) (actual time=0.006..0.432 rows=265 loops=1)

  • Index Cond: (end_ IS NULL)
77. 0.265 0.265 ↑ 1.0 1 265

Index Only Scan using bort_id_pk on bort bort_8 (cost=0.29..1.65 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=265)

  • Index Cond: (id = orders_9.id_bort)
  • Heap Fetches: 227
78. 0.488 0.488 ↓ 0.0 0 244

Index Scan using tochki_idx on tochki tochki_7 (cost=0.56..13.89 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=244)

  • Index Cond: (id_order = orders_9.id)
  • Filter: ((end_ IS NULL) AND (del_ IS NULL) AND pervaya)
  • Rows Removed by Filter: 2
Planning time : 9.871 ms