explain.depesz.com

PostgreSQL's explain analyze made readable

Result: IX19

Settings
# exclusive inclusive rows x rows loops node
1. 0.034 4,936.712 ↓ 0.0 0 1

Sort (cost=1,233,272.54..1,233,272.54 rows=1 width=78) (actual time=4,936.712..4,936.712 rows=0 loops=1)

  • Sort Key: r.special_control DESC, ur.name, ((SubPlan 12))
  • Sort Method: quicksort Memory: 25kB
2. 0.000 4,936.678 ↓ 0.0 0 1

Nested Loop Left Join (cost=179,823.92..1,233,272.53 rows=1 width=78) (actual time=4,936.678..4,936.678 rows=0 loops=1)

3. 0.001 4,936.678 ↓ 0.0 0 1

Nested Loop Left Join (cost=179,823.49..1,233,140.34 rows=1 width=69) (actual time=4,936.678..4,936.678 rows=0 loops=1)

4. 0.000 4,936.677 ↓ 0.0 0 1

Nested Loop (cost=179,822.92..1,233,136.85 rows=1 width=69) (actual time=4,936.677..4,936.677 rows=0 loops=1)

5. 0.001 4,936.677 ↓ 0.0 0 1

Nested Loop (cost=179,822.50..1,233,135.09 rows=1 width=63) (actual time=4,936.677..4,936.677 rows=0 loops=1)

6. 0.000 4,936.676 ↓ 0.0 0 1

Nested Loop (cost=179,821.93..1,233,133.16 rows=1 width=71) (actual time=4,936.676..4,936.676 rows=0 loops=1)

7. 0.395 4,936.676 ↓ 0.0 0 1

Nested Loop (cost=179,821.36..1,233,104.91 rows=8 width=50) (actual time=4,936.676..4,936.676 rows=0 loops=1)

8. 3.367 4,313.477 ↓ 8.4 413 1

Nested Loop (cost=179,820.79..1,227,330.40 rows=49 width=40) (actual time=1,514.305..4,313.477 rows=413 loops=1)

9. 455.075 3,687.410 ↓ 13.1 9,580 1

Hash Join (cost=179,820.22..1,204,591.29 rows=732 width=42) (actual time=1,514.269..3,687.410 rows=9,580 loops=1)

  • Hash Cond: (dcc.author = ua.id)
10. 2,001.664 3,232.126 ↓ 6.9 4,167,539 1

Bitmap Heap Scan on document_control dcc (cost=179,785.92..1,202,281.16 rows=604,937 width=50) (actual time=1,485.189..3,232.126 rows=4,167,539 loops=1)

  • Recheck Cond: (((stop_date IS NULL) AND (is_control = 1)) OR ((stop_date >= '2018-12-01 00:00:00'::timestamp without time zone) AND (stop_date <= '2018-01-01 00:00:00'::timestamp without time zone)))
  • Heap Blocks: exact=907317
11. 0.001 1,230.462 ↓ 0.0 0 1

BitmapOr (cost=179,785.92..179,785.92 rows=606,073 width=0) (actual time=1,230.462..1,230.462 rows=0 loops=1)

12. 248.834 1,230.414 ↓ 0.0 0 1

BitmapAnd (cost=171,689.22..171,689.22 rows=227,183 width=0) (actual time=1,230.414..1,230.414 rows=0 loops=1)

13. 486.027 486.027 ↓ 1.0 4,317,498 1

Bitmap Index Scan on document_control_stop_date_idx (cost=0.00..77,873.28 rows=4,216,628 width=0) (actual time=486.027..486.027 rows=4,317,498 loops=1)

  • Index Cond: (stop_date IS NULL)
14. 495.553 495.553 ↓ 1.0 4,198,652 1

Bitmap Index Scan on dc_is_c_edate_idx (cost=0.00..93,513.22 rows=4,082,754 width=0) (actual time=495.553..495.553 rows=4,198,652 loops=1)

  • Index Cond: (is_control = 1)
15. 0.047 0.047 ↓ 0.0 0 1

Bitmap Index Scan on document_control_stop_date_idx (cost=0.00..7,945.47 rows=378,890 width=0) (actual time=0.047..0.047 rows=0 loops=1)

  • Index Cond: ((stop_date >= '2018-12-01 00:00:00'::timestamp without time zone) AND (stop_date <= '2018-01-01 00:00:00'::timestamp without time zone))
16. 0.074 0.209 ↑ 1.0 716 1

Hash (cost=25.18..25.18 rows=729 width=8) (actual time=0.209..0.209 rows=716 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 36kB
17. 0.135 0.135 ↑ 1.0 716 1

Index Only Scan using "idx$$_6d740003" on usr ua (cost=0.42..25.18 rows=729 width=8) (actual time=0.029..0.135 rows=716 loops=1)

  • Index Cond: (group_id = 29)
  • Heap Fetches: 16
18. 609.245 622.700 ↓ 0.0 0 9,580

Index Scan using sys_c0014909 on resolution_to rt (cost=0.57..31.05 rows=1 width=24) (actual time=0.065..0.065 rows=0 loops=9,580)

  • Index Cond: (id = dcc.resolution_to_id)
  • Filter: ((primary_id IS NULL) AND (another_control = 1) AND (((dcc.stop_date IS NULL) AND (dcc.is_control = 1) AND (CASE WHEN (dcc.has_prodl IS NULL) THEN dcc.exec_date ELSE (SubPlan 15) END <= '2018-01-01 00:00:00'::timestamp without time zone)) OR ((dcc.stop_date >= '2018-12-01 00:00:00'::timestamp without time zone) AND (dcc.stop_date <= '2018-01-01 00:00:00'::timestamp without time zone))))
  • Rows Removed by Filter: 1
19.          

SubPlan (forIndex Scan)

20. 0.117 13.455 ↑ 1.0 1 117

Unique (cost=23.63..23.63 rows=1 width=16) (actual time=0.114..0.115 rows=1 loops=117)

21.          

Initplan (forUnique)

22. 0.000 0.000 ↓ 0.0 0

Result (cost=4.59..4.60 rows=1 width=8) (never executed)

23.          

Initplan (forResult)

24. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.57..4.59 rows=1 width=8) (never executed)

25. 0.000 0.000 ↓ 0.0 0

Index Only Scan Backward using exec_event_test3 on exec_event exec_event_1 (cost=0.57..4.59 rows=1 width=8) (never executed)

  • Index Cond: ((resolution_to_id = rt.id) AND ("TYPE" = 0) AND (cdate IS NOT NULL))
  • Heap Fetches: 0
26. 0.468 13.338 ↓ 5.0 5 117

Sort (cost=19.02..19.03 rows=1 width=16) (actual time=0.113..0.114 rows=5 loops=117)

  • Sort Key: (first_value(eep_1.exec_date) OVER (?))
  • Sort Method: quicksort Memory: 25kB
27. 0.351 12.870 ↓ 5.0 5 117

WindowAgg (cost=18.99..19.01 rows=1 width=16) (actual time=0.108..0.110 rows=5 loops=117)

28. 0.351 12.519 ↓ 5.0 5 117

Sort (cost=18.99..19.00 rows=1 width=16) (actual time=0.106..0.107 rows=5 loops=117)

  • Sort Key: eep_1.cdate DESC
  • Sort Method: quicksort Memory: 25kB
29. 0.459 12.168 ↓ 5.0 5 117

Nested Loop Anti Join (cost=1.14..18.98 rows=1 width=16) (actual time=0.058..0.104 rows=5 loops=117)

  • Join Filter: (ee2_8.cdate <= eep_1.cdate)
30. 8.307 8.307 ↓ 5.0 5 117

Index Scan using ee_res_to_id_idx on exec_event eep_1 (cost=0.57..10.37 rows=1 width=16) (actual time=0.026..0.071 rows=5 loops=117)

  • Index Cond: (resolution_to_id = rt.id)
  • Filter: (("TYPE" = 0) OR (("TYPE" = 1) AND (counters = 0)))
31. 0.000 3.402 ↓ 0.0 0 567

Materialize (cost=0.57..8.60 rows=1 width=8) (actual time=0.006..0.006 rows=0 loops=567)

32. 3.510 3.510 ↓ 0.0 0 117

Index Scan using exec_event_test on exec_event ee2_8 (cost=0.57..8.59 rows=1 width=8) (actual time=0.030..0.030 rows=0 loops=117)

  • Index Cond: ((resolution_to_id = rt.id) AND ("TYPE" = 1) AND (counters = 1))
  • Filter: (cdate >= $30)
33. 3.568 622.804 ↓ 0.0 0 413

Index Scan using sys_c0014877 on resolution r (cost=0.57..117.84 rows=1 width=26) (actual time=1.508..1.508 rows=0 loops=413)

  • Index Cond: (id = rt.resolution_id)
  • Filter: ((is_project = 0) AND (is_forward = 0) AND (is_csdr = 0) AND ((has_vzamen IS NULL) OR (NOT (SubPlan 16))) AND ((SubPlan 25) > 0))
  • Rows Removed by Filter: 1
34.          

SubPlan (forIndex Scan)

35. 0.000 0.000 ↓ 0.0 0

Index Only Scan using res_vzamen_isproj_isfwd_idx on resolution rv (cost=0.57..8.59 rows=1 width=0) (never executed)

  • Index Cond: ((vzamen = r.id) AND (is_project = 0) AND (is_forward = 0))
  • Heap Fetches: 0
36. 0.412 619.236 ↑ 1.0 1 412

Unique (cost=105.49..105.50 rows=1 width=12) (actual time=1.502..1.503 rows=1 loops=412)

37. 2.060 618.824 ↑ 1.0 1 412

Sort (cost=105.49..105.49 rows=1 width=12) (actual time=1.502..1.502 rows=1 loops=412)

  • Sort Key: (first_value(GREATEST(0, (date_part('day'::text, CASE WHEN ((ee_1.""TYPE"" = ANY ('{1,2,4}'::bigint[])) AND (ee_1.counters = 1)) THEN CASE WHEN (SubPlan 17) THEN (dn_2.rdate - (SubPlan 18)) ELSE CASE WHEN ((SubPlan 19) = 3) THEN ((SubPlan 20) - (SubPlan 21)) ELSE (CASE ee_1.""TYPE"" WHEN 1 THEN ee_1.cdate WHEN 2 THEN ee_1.exec_date WHEN 4 THEN ee_1.cdate ELSE NULL::timestamp without time zone END - (SubPlan 22)) END END ELSE CASE WHEN ((ee_1.""TYPE"" = 3) AND (NOT (SubPlan 23))) THEN (dn_2.rdate - (SubPlan 24)) ELSE NULL::interval END END))::integer)) OVER (?))
  • Sort Method: quicksort Memory: 25kB
38. 1.744 616.764 ↑ 1.0 1 412

WindowAgg (cost=1.57..105.48 rows=1 width=12) (actual time=1.368..1.497 rows=1 loops=412)

39. 0.391 613.880 ↑ 1.0 1 412

Nested Loop Left Join (cost=1.57..38.29 rows=1 width=50) (actual time=1.362..1.490 rows=1 loops=412)

  • Filter: ((dn_2.id IS NULL) OR ((dn_2.n = 0) AND (dn_2.org_id = r.r_org_id)))
40. 0.719 613.056 ↑ 2.0 1 412

Nested Loop Left Join (cost=1.00..28.26 rows=2 width=42) (actual time=1.360..1.488 rows=1 loops=412)

41. 610.172 610.172 ↑ 2.0 1 412

Index Scan Backward using ev_rtid_cd_idx on exec_event ee_1 (cost=0.57..11.34 rows=2 width=42) (actual time=1.353..1.481 rows=1 loops=412)

  • Index Cond: (resolution_to_id = rt.id)
42. 2.165 2.165 ↓ 0.0 0 433

Index Scan using fk_autoidx_1 on exec_event_d eed_1 (cost=0.43..8.45 rows=1 width=16) (actual time=0.005..0.005 rows=0 loops=433)

  • Index Cond: (exec_event_id = ee_1.id)
43. 0.433 0.433 ↓ 0.0 0 433

Index Scan using dn_doc_id_idx on document_n dn_2 (cost=0.57..4.07 rows=63 width=40) (actual time=0.001..0.001 rows=0 loops=433)

  • Index Cond: (document_id = eed_1.document_id)
44.          

SubPlan (forWindowAgg)

45. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.14..17.19 rows=1 width=0) (never executed)

46. 0.000 0.000 ↓ 0.0 0

Index Scan using rt_primary_id_idx on resolution_to rti_1 (cost=0.57..8.59 rows=1 width=8) (never executed)

  • Index Cond: (COALESCE(primary_id, id) = ee_1.resolution_to_id)
47. 0.000 0.000 ↓ 0.0 0

Index Scan using sys_c0014877 on resolution ri_1 (cost=0.57..8.59 rows=1 width=8) (never executed)

  • Index Cond: (id = rti_1.resolution_id)
  • Filter: (document_id = dn_2.document_id)
48. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.65..4.65 rows=1 width=16) (never executed)

49. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.65..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_9.exec_date) OVER (?))
50. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.62..4.64 rows=1 width=16) (never executed)

51. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.62..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_9.cdate DESC
52. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_9 (cost=0.57..4.61 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate < ee_1.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0
53. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.64..4.65 rows=1 width=16) (never executed)

54. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.64..4.64 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_10."TYPE") OVER (?))
55. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.61..4.63 rows=1 width=16) (never executed)

56. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.61..4.61 rows=1 width=16) (never executed)

  • Sort Key: ee2_10.cdate DESC
57. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_10 (cost=0.57..4.60 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate < ee_1.cdate))
  • Heap Fetches: 0
58. 0.000 0.000 ↓ 0.0 0

Unique (cost=22.09..22.10 rows=1 width=16) (never executed)

59. 0.000 0.000 ↓ 0.0 0

Sort (cost=22.09..22.10 rows=1 width=16) (never executed)

  • Sort Key: (first_value(dn2_1.rdate) OVER (?))
60. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=1.57..22.08 rows=1 width=16) (never executed)

61. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.57..22.07 rows=1 width=16) (never executed)

  • Filter: ((dn2_1.id IS NULL) OR ((dn2_1.n = 0) AND (dn2_1.org_id = r.r_org_id)))
62. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.00..17.05 rows=1 width=16) (never executed)

63. 0.000 0.000 ↓ 0.0 0

Index Scan Backward using exec_event_test3 on exec_event ee2_11 (cost=0.57..8.59 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND ("TYPE" = 3) AND (cdate < ee_1.cdate))
64. 0.000 0.000 ↓ 0.0 0

Index Scan using fk_autoidx_1 on exec_event_d eed2_1 (cost=0.43..8.45 rows=1 width=16) (never executed)

  • Index Cond: (exec_event_id = ee2_11.id)
65. 0.000 0.000 ↓ 0.0 0

Index Scan using dn_doc_id_idx on document_n dn2_1 (cost=0.57..4.07 rows=63 width=40) (never executed)

  • Index Cond: (document_id = eed2_1.document_id)
66. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.64..4.65 rows=1 width=16) (never executed)

67. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.64..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_12.exec_date) OVER (?))
68. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.61..4.63 rows=1 width=16) (never executed)

69. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.61..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_12.cdate DESC
70. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_12 (cost=0.57..4.60 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate < ee_1.cdate))
  • Filter: (""TYPE"" = ANY ('{0,1}'::bigint[]))
  • Heap Fetches: 0
71. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.65..4.65 rows=1 width=16) (never executed)

72. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.65..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_13.exec_date) OVER (?))
73. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.62..4.64 rows=1 width=16) (never executed)

74. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.62..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_13.cdate DESC
75. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_13 (cost=0.57..4.61 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate < ee_1.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0
76. 0.036 0.036 ↓ 0.0 0 6

Index Only Scan using ev_rtid_cd_idx on exec_event ee2_14 (cost=0.57..4.59 rows=1 width=0) (actual time=0.006..0.006 rows=0 loops=6)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate > ee_1.cdate))
  • Heap Fetches: 0
77. 0.012 1.104 ↑ 1.0 1 6

Unique (cost=4.65..4.65 rows=1 width=16) (actual time=0.183..0.184 rows=1 loops=6)

78. 0.072 1.092 ↑ 1.0 1 6

Sort (cost=4.65..4.65 rows=1 width=16) (actual time=0.182..0.182 rows=1 loops=6)

  • Sort Key: (first_value(ee2_15.exec_date) OVER (?))
  • Sort Method: quicksort Memory: 25kB
79. 0.036 1.020 ↑ 1.0 1 6

WindowAgg (cost=4.62..4.64 rows=1 width=16) (actual time=0.169..0.170 rows=1 loops=6)

80. 0.066 0.984 ↑ 1.0 1 6

Sort (cost=4.62..4.62 rows=1 width=16) (actual time=0.163..0.164 rows=1 loops=6)

  • Sort Key: ee2_15.cdate DESC
  • Sort Method: quicksort Memory: 25kB
81. 0.918 0.918 ↑ 1.0 1 6

Index Only Scan using exec_event_test3 on exec_event ee2_15 (cost=0.57..4.61 rows=1 width=16) (actual time=0.153..0.153 rows=1 loops=6)

  • Index Cond: ((resolution_to_id = ee_1.resolution_to_id) AND (cdate < ee_1.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0
82. 0.000 0.000 ↓ 0.0 0

Index Scan using "idx$$_727b0002" on document_n dn (cost=0.57..3.52 rows=1 width=21) (never executed)

  • Index Cond: ((org_id = 29) AND (document_id = r.document_id))
  • Filter: ((category <> 6) AND (n = 0) AND (CASE WHEN (num IS NULL) THEN 0 ELSE 1 END = 1) AND (((num)::text ~~ '01-02-06%'::text) OR ((num)::text ~~ '01-03-06%'::text) OR ((num)::text ~~ '01-04-06%'::text) OR ((num)::text ~~ '05-07%'::text) OR ((num)::text ~~ '05-08%'::text) OR ((num)::text ~~ '05-09%'::text) OR ((num)::text ~~ '05-10%'::text) OR ((num)::text ~~ '05-11%'::text) OR ((num)::text ~~ '05-12%'::text) OR ((num)::text ~~ '05-13%'::text) OR ((num)::text ~~ '05-14%'::text) OR ((num)::text ~~ '05-15%'::text) OR ((num)::text ~~ '05-16%'::text) OR ((num)::text ~~ 'ВН-01-02-06%'::text) OR ((num)::text ~~ 'ВН-01-03-06%'::text) OR ((num)::text ~~ 'ВН-01-04-06%'::text) OR ((num)::text ~~ 'ВН-05-01%'::text) OR ((num)::text ~~ 'ВН-05-02%'::text) OR ((num)::text ~~ 'ВН-05-03%'::text) OR ((num)::text ~~ 'ВН-05-04%'::text) OR ((num)::text ~~ 'ВН-05-05%'::text) OR ((num)::text ~~ 'ВН-05-06%'::text) OR ((num)::text ~~ 'ВН-05-07%'::text) OR ((num)::text ~~ 'ВН-05-08%'::text) OR ((num)::text ~~ 'ВН-05-09%'::text) OR ((num)::text ~~ 'ВН-05-10%'::text) OR ((num)::text ~~ 'ВН-05-11%'::text) OR ((num)::text ~~ 'ВН-05-12%'::text) OR ((num)::text ~~ 'ВН-05-13%'::text) OR ((num)::text ~~ 'ВН-05-14%'::text) OR ((num)::text ~~ 'ВН-05-15%'::text) OR ((num)::text ~~ 'ВН-05-16%'::text) OR ((num)::text ~~ 'ВН-05-17%'::text) OR ((num)::text ~~ 'ВН-05-18%'::text) OR ((num)::text ~~ 'ВН-05-18и%'::text) OR ((num)::text ~~ 'ВН-05-19%'::text) OR ((num)::text ~~ 'ВН-05-20%'::text) OR ((num)::text ~~ 'ВН-05-21%'::text) OR ((num)::text ~~ 'ВН-05-22%'::text) OR ((num)::text ~~ 'ВОЗВРАТ%'::text) OR ((num)::text ~~ 'ВОЗВРАТ ВН%'::text) OR ((num)::text ~~ 'ДПиООС 01-02-06%'::text) OR ((num)::text ~~ 'ДПиООС 01-03-06%'::text) OR ((num)::text ~~ 'ДПиООС 01-04-06%'::text) OR ((num)::text ~~ 'ДПиООС 05-01%'::text) OR ((num)::text ~~ 'ДПиООС 05-02%'::text) OR ((num)::text ~~ 'ДПиООС 05-03%'::text) OR ((num)::text ~~ 'ДПиООС 05-04%'::text) OR ((num)::text ~~ 'ДПиООС 05-05%'::text) OR ((num)::text ~~ 'ДПиООС 05-06%'::text) OR ((num)::text ~~ 'ДПиООС 05-07%'::text) OR ((num)::text ~~ 'ДПиООС 05-08%'::text) OR ((num)::text ~~ 'ДПиООС 05-09%'::text) OR ((num)::text ~~ 'ДПиООС 05-10%'::text) OR ((num)::text ~~ 'ДПиООС 05-11%'::text) OR ((num)::text ~~ 'ДПиООС 05-12%'::text) OR ((num)::text ~~ 'ДПиООС 05-13%'::text) OR ((num)::text ~~ 'ДПиООС 05-14%'::text) OR ((num)::text ~~ 'ДПиООС 05-15%'::text) OR ((num)::text ~~ 'ДПиООС 05-16%'::text) OR ((num)::text ~~ 'ДПиООС 05-17%'::text) OR ((num)::text ~~ 'ДПиООС 05-18%'::text) OR ((num)::text ~~ 'ДПиООС 05-18и%'::text) OR ((num)::text ~~ 'ДПиООС 05-19%'::text) OR ((num)::text ~~ 'ДПиООС 05-20%'::text) OR ((num)::text ~~ 'ДПиООС 05-21%'::text) OR ((num)::text ~~ 'ДПиООС 05-22%'::text) OR ((num)::text ~~ 'ДПиООС 05-69%'::text) OR ((num)::text ~~ 'ДПиООС 07-67%'::text) OR ((num)::text ~~ 'ДПиООС 07-68%'::text) OR ((num)::text ~~ 'ДПиООС 07-69%'::text)))
83. 0.000 0.000 ↓ 0.0 0

Index Only Scan using d_del_id_idx on document d (cost=0.57..1.92 rows=1 width=8) (never executed)

  • Index Cond: ((deleted = 0) AND (id = r.document_id))
  • Heap Fetches: 0
84. 0.000 0.000 ↓ 0.0 0

Index Only Scan using usr_id_name_freq_idx on usr ur (cost=0.42..1.75 rows=1 width=22) (never executed)

  • Index Cond: (id = dcc.executor)
  • Heap Fetches: 0
85. 0.000 0.000 ↓ 0.0 0

Index Scan using resolution_order_pk on resolution_order ro (cost=0.57..3.48 rows=1 width=16) (never executed)

  • Index Cond: (id = rt.resolution_order_id)
86. 0.000 0.000 ↓ 0.0 0

Index Scan using usr_id_name_freq_idx on usr udc (cost=0.42..3.04 rows=1 width=29) (never executed)

  • Index Cond: (id = ro.curator)
87.          

SubPlan (forNested Loop Left Join)

88. 0.000 0.000 ↓ 0.0 0

Unique (cost=23.63..23.63 rows=1 width=16) (never executed)

89.          

Initplan (forUnique)

90. 0.000 0.000 ↓ 0.0 0

Result (cost=4.59..4.60 rows=1 width=8) (never executed)

91.          

Initplan (forResult)

92. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.57..4.59 rows=1 width=8) (never executed)

93. 0.000 0.000 ↓ 0.0 0

Index Only Scan Backward using exec_event_test3 on exec_event (cost=0.57..4.59 rows=1 width=8) (never executed)

  • Index Cond: ((resolution_to_id = rt.id) AND ("TYPE" = 0) AND (cdate IS NOT NULL))
  • Heap Fetches: 0
94. 0.000 0.000 ↓ 0.0 0

Sort (cost=19.02..19.03 rows=1 width=16) (never executed)

  • Sort Key: (first_value(eep.exec_date) OVER (?))
95. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=18.99..19.01 rows=1 width=16) (never executed)

96. 0.000 0.000 ↓ 0.0 0

Sort (cost=18.99..19.00 rows=1 width=16) (never executed)

  • Sort Key: eep.cdate DESC
97. 0.000 0.000 ↓ 0.0 0

Nested Loop Anti Join (cost=1.14..18.98 rows=1 width=16) (never executed)

  • Join Filter: (ee2.cdate <= eep.cdate)
98. 0.000 0.000 ↓ 0.0 0

Index Scan using ee_res_to_id_idx on exec_event eep (cost=0.57..10.37 rows=1 width=16) (never executed)

  • Index Cond: (resolution_to_id = rt.id)
  • Filter: (("TYPE" = 0) OR (("TYPE" = 1) AND (counters = 0)))
99. 0.000 0.000 ↓ 0.0 0

Materialize (cost=0.57..8.60 rows=1 width=8) (never executed)

100. 0.000 0.000 ↓ 0.0 0

Index Scan using exec_event_test on exec_event ee2 (cost=0.57..8.59 rows=1 width=8) (never executed)

  • Index Cond: ((resolution_to_id = rt.id) AND ("TYPE" = 1) AND (counters = 1))
  • Filter: (cdate >= $2)
101. 0.000 0.000 ↓ 0.0 0

Unique (cost=105.49..105.50 rows=1 width=12) (never executed)

102. 0.000 0.000 ↓ 0.0 0

Sort (cost=105.49..105.49 rows=1 width=12) (never executed)

  • Sort Key: (first_value(GREATEST(0, (date_part('day'::text, CASE WHEN ((ee.""TYPE"" = ANY ('{1,2,4}'::bigint[])) AND (ee.counters = 1)) THEN CASE WHEN (SubPlan 4) THEN (dn_1.rdate - (SubPlan 5)) ELSE CASE WHEN ((SubPlan 6) = 3) THEN ((SubPlan 7) - (SubPlan 8)) ELSE (CASE ee.""TYPE"" WHEN 1 THEN ee.cdate WHEN 2 THEN ee.exec_date WHEN 4 THEN ee.cdate ELSE NULL::timestamp without time zone END - (SubPlan 9)) END END ELSE CASE WHEN ((ee.""TYPE"" = 3) AND (NOT (SubPlan 10))) THEN (dn_1.rdate - (SubPlan 11)) ELSE NULL::interval END END))::integer)) OVER (?))
103. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=1.57..105.48 rows=1 width=12) (never executed)

104. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.57..38.29 rows=1 width=50) (never executed)

  • Filter: ((dn_1.id IS NULL) OR ((dn_1.n = 0) AND (dn_1.org_id = r.r_org_id)))
105. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.00..28.26 rows=2 width=42) (never executed)

106. 0.000 0.000 ↓ 0.0 0

Index Scan Backward using ev_rtid_cd_idx on exec_event ee (cost=0.57..11.34 rows=2 width=42) (never executed)

  • Index Cond: (resolution_to_id = rt.id)
107. 0.000 0.000 ↓ 0.0 0

Index Scan using fk_autoidx_1 on exec_event_d eed (cost=0.43..8.45 rows=1 width=16) (never executed)

  • Index Cond: (exec_event_id = ee.id)
108. 0.000 0.000 ↓ 0.0 0

Index Scan using dn_doc_id_idx on document_n dn_1 (cost=0.57..4.07 rows=63 width=40) (never executed)

  • Index Cond: (document_id = eed.document_id)
109.          

SubPlan (forWindowAgg)

110. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=1.14..17.19 rows=1 width=0) (never executed)

111. 0.000 0.000 ↓ 0.0 0

Index Scan using rt_primary_id_idx on resolution_to rti (cost=0.57..8.59 rows=1 width=8) (never executed)

  • Index Cond: (COALESCE(primary_id, id) = ee.resolution_to_id)
112. 0.000 0.000 ↓ 0.0 0

Index Scan using sys_c0014877 on resolution ri (cost=0.57..8.59 rows=1 width=8) (never executed)

  • Index Cond: (id = rti.resolution_id)
  • Filter: (document_id = dn_1.document_id)
113. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.65..4.65 rows=1 width=16) (never executed)

114. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.65..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_1.exec_date) OVER (?))
115. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.62..4.64 rows=1 width=16) (never executed)

116. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.62..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_1.cdate DESC
117. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_1 (cost=0.57..4.61 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate < ee.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0
118. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.64..4.65 rows=1 width=16) (never executed)

119. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.64..4.64 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_2."TYPE") OVER (?))
120. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.61..4.63 rows=1 width=16) (never executed)

121. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.61..4.61 rows=1 width=16) (never executed)

  • Sort Key: ee2_2.cdate DESC
122. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_2 (cost=0.57..4.60 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate < ee.cdate))
  • Heap Fetches: 0
123. 0.000 0.000 ↓ 0.0 0

Unique (cost=22.09..22.10 rows=1 width=16) (never executed)

124. 0.000 0.000 ↓ 0.0 0

Sort (cost=22.09..22.10 rows=1 width=16) (never executed)

  • Sort Key: (first_value(dn2.rdate) OVER (?))
125. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=1.57..22.08 rows=1 width=16) (never executed)

126. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.57..22.07 rows=1 width=16) (never executed)

  • Filter: ((dn2.id IS NULL) OR ((dn2.n = 0) AND (dn2.org_id = r.r_org_id)))
127. 0.000 0.000 ↓ 0.0 0

Nested Loop Left Join (cost=1.00..17.05 rows=1 width=16) (never executed)

128. 0.000 0.000 ↓ 0.0 0

Index Scan Backward using exec_event_test3 on exec_event ee2_3 (cost=0.57..8.59 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND ("TYPE" = 3) AND (cdate < ee.cdate))
129. 0.000 0.000 ↓ 0.0 0

Index Scan using fk_autoidx_1 on exec_event_d eed2 (cost=0.43..8.45 rows=1 width=16) (never executed)

  • Index Cond: (exec_event_id = ee2_3.id)
130. 0.000 0.000 ↓ 0.0 0

Index Scan using dn_doc_id_idx on document_n dn2 (cost=0.57..4.07 rows=63 width=40) (never executed)

  • Index Cond: (document_id = eed2.document_id)
131. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.64..4.65 rows=1 width=16) (never executed)

132. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.64..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_4.exec_date) OVER (?))
133. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.61..4.63 rows=1 width=16) (never executed)

134. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.61..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_4.cdate DESC
135. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_4 (cost=0.57..4.60 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate < ee.cdate))
  • Filter: (""TYPE"" = ANY ('{0,1}'::bigint[]))
  • Heap Fetches: 0
136. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.65..4.65 rows=1 width=16) (never executed)

137. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.65..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_5.exec_date) OVER (?))
138. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.62..4.64 rows=1 width=16) (never executed)

139. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.62..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_5.cdate DESC
140. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_5 (cost=0.57..4.61 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate < ee.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0
141. 0.000 0.000 ↓ 0.0 0

Index Only Scan using ev_rtid_cd_idx on exec_event ee2_6 (cost=0.57..4.59 rows=1 width=0) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate > ee.cdate))
  • Heap Fetches: 0
142. 0.000 0.000 ↓ 0.0 0

Unique (cost=4.65..4.65 rows=1 width=16) (never executed)

143. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.65..4.65 rows=1 width=16) (never executed)

  • Sort Key: (first_value(ee2_7.exec_date) OVER (?))
144. 0.000 0.000 ↓ 0.0 0

WindowAgg (cost=4.62..4.64 rows=1 width=16) (never executed)

145. 0.000 0.000 ↓ 0.0 0

Sort (cost=4.62..4.62 rows=1 width=16) (never executed)

  • Sort Key: ee2_7.cdate DESC
146. 0.000 0.000 ↓ 0.0 0

Index Only Scan using exec_event_test3 on exec_event ee2_7 (cost=0.57..4.61 rows=1 width=16) (never executed)

  • Index Cond: ((resolution_to_id = ee.resolution_to_id) AND (cdate < ee.cdate) AND (exec_date IS NOT NULL))
  • Heap Fetches: 0