explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QzSC

Settings
# exclusive inclusive rows x rows loops node
1. 3.186 647.692 ↓ 296.0 296 1

Group (cost=20,299.48..20,302.69 rows=1 width=293) (actual time=630.635..647.692 rows=296 loops=1)

  • Group Key: csla.id, r.name, ets.description, c.name, c.document_title
2.          

CTE domain_user_with_flowdown_rgs

3. 0.831 622.424 ↓ 148.0 592 1

HashAggregate (cost=20,274.37..20,274.41 rows=4 width=1,330) (actual time=622.132..622.424 rows=592 loops=1)

  • Group Key: du_1.entity_id, du_1.role_group_id, du_1.user_group_id, du_1.user_id, rg.client_id, rg.entity_type_id, u.first_name, u.last_name, ug_3.name
4. 0.225 621.593 ↓ 148.0 592 1

Append (cost=75.64..20,274.28 rows=4 width=1,330) (actual time=225.222..621.593 rows=592 loops=1)

5. 0.293 273.099 ↓ 148.0 296 1

Nested Loop Left Join (cost=75.64..14,269.94 rows=2 width=311) (actual time=225.221..273.099 rows=296 loops=1)

6. 0.360 272.806 ↓ 148.0 296 1

Nested Loop Left Join (cost=75.51..14,269.64 rows=2 width=37) (actual time=225.215..272.806 rows=296 loops=1)

7. 20.531 270.670 ↓ 148.0 296 1

Nested Loop (cost=75.23..14,268.99 rows=2 width=24) (actual time=225.197..270.670 rows=296 loops=1)

8. 8.908 24.671 ↓ 11.6 25,052 1

Nested Loop (cost=74.82..12,094.98 rows=2,168 width=24) (actual time=2.685..24.671 rows=25,052 loops=1)

9. 0.139 0.139 ↓ 2.0 2 1

Index Scan using pk_role_group on role_group rg (cost=0.14..17.37 rows=1 width=12) (actual time=0.021..0.139 rows=2 loops=1)

  • Filter: ((entity_type_id = 15) AND (client_id = 1,002))
  • Rows Removed by Filter: 226
10. 13.362 15.624 ↓ 3.4 12,526 2

Bitmap Heap Scan on domain_user du_1 (cost=74.67..12,041.02 rows=3,659 width=16) (actual time=1.334..7.812 rows=12,526 loops=2)

  • Recheck Cond: (role_group_id = rg.id)
  • Filter: ((NOT entity_deleted) AND ((user_id = 1,044) OR (SubPlan 1)))
  • Rows Removed by Filter: 3,300
  • Heap Blocks: exact=1,162
11. 1.344 1.344 ↓ 2.3 15,826 2

Bitmap Index Scan on idx_domain_user_3 (cost=0.00..73.76 rows=6,991 width=0) (actual time=0.672..0.672 rows=15,826 loops=2)

  • Index Cond: (role_group_id = rg.id)
12.          

SubPlan (for Bitmap Heap Scan)

13. 0.000 0.918 ↓ 0.0 0 918

ProjectSet (cost=0.00..1.61 rows=100 width=4) (actual time=0.001..0.001 rows=0 loops=918)

14. 0.918 0.918 ↓ 0.0 0 918

Seq Scan on user_group ug (cost=0.00..1.10 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=918)

  • Filter: (id = du_1.user_group_id)
  • Rows Removed by Filter: 8
15. 225.468 225.468 ↓ 0.0 0 25,052

Index Scan using pk_child_sla on child_sla csla_1 (cost=0.41..1.00 rows=1 width=4) (actual time=0.009..0.009 rows=0 loops=25,052)

  • Index Cond: (id = du_1.entity_id)
  • Filter: ((NOT deleted) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date >= '2020-07-24 00:00:00'::timestamp without time zone) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date <= '2020-09-15 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 1
16. 1.776 1.776 ↑ 1.0 1 296

Index Scan using pk_app_user on app_user u (cost=0.28..0.32 rows=1 width=17) (actual time=0.006..0.006 rows=1 loops=296)

  • Index Cond: (du_1.user_id = id)
17. 0.000 0.000 ↓ 0.0 0 296

Index Scan using pk_user_group on user_group ug_3 (cost=0.13..0.15 rows=1 width=278) (actual time=0.000..0.000 rows=0 loops=296)

  • Index Cond: (du_1.user_group_id = id)
18. 0.000 23.849 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,556.01..2,811.62 rows=1 width=311) (actual time=23.849..23.849 rows=0 loops=1)

19. 0.001 23.849 ↓ 0.0 0 1

Nested Loop Left Join (cost=1,555.88..2,811.46 rows=1 width=37) (actual time=23.849..23.849 rows=0 loops=1)

20. 0.004 23.848 ↓ 0.0 0 1

Merge Join (cost=1,555.61..2,811.14 rows=1 width=24) (actual time=23.848..23.848 rows=0 loops=1)

  • Merge Cond: (prg.id = crg.flowdown_rolegroup)
21. 0.004 23.816 ↑ 30.0 1 1

Nested Loop (cost=1,551.40..39,216.80 rows=30 width=20) (actual time=23.816..23.816 rows=1 loops=1)

  • Join Filter: (du_2.role_group_id = prg.id)
22. 0.012 0.012 ↑ 16.0 1 1

Index Scan using pk_role_group on role_group prg (cost=0.14..16.83 rows=16 width=4) (actual time=0.012..0.012 rows=1 loops=1)

  • Filter: (entity_type_id = 61)
  • Rows Removed by Filter: 1
23. 0.002 23.800 ↑ 409.0 1 1

Materialize (cost=1,551.25..39,102.83 rows=409 width=16) (actual time=23.800..23.800 rows=1 loops=1)

24. 0.004 23.798 ↑ 409.0 1 1

Nested Loop (cost=1,551.25..39,100.79 rows=409 width=16) (actual time=23.798..23.798 rows=1 loops=1)

25. 9.732 23.762 ↑ 158.0 1 1

Bitmap Heap Scan on child_sla et (cost=1,550.83..37,593.27 rows=158 width=8) (actual time=23.761..23.762 rows=1 loops=1)

  • Filter: ((NOT deleted) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date >= '2020-07-24 00:00:00'::timestamp without time zone) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date <= '2020-09-15 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 1,010
  • Heap Blocks: exact=242
26. 14.030 14.030 ↓ 5.9 188,456 1

Bitmap Index Scan on idx_child_sla_deleted_client_id_slaid (cost=0.00..1,550.79 rows=31,684 width=0) (actual time=14.030..14.030 rows=188,456 loops=1)

  • Index Cond: (deleted = false)
27. 0.022 0.032 ↑ 3.0 1 1

Index Scan using idx_du_entity_id on domain_user du_2 (cost=0.42..9.51 rows=3 width=16) (actual time=0.032..0.032 rows=1 loops=1)

  • Index Cond: (entity_id = et.contract_id)
  • Filter: ((user_id = 1,044) OR (SubPlan 2))
  • Rows Removed by Filter: 5
28.          

SubPlan (for Index Scan)

29. 0.000 0.010 ↓ 0.0 0 5

ProjectSet (cost=0.00..1.61 rows=100 width=4) (actual time=0.002..0.002 rows=0 loops=5)

30. 0.010 0.010 ↓ 0.0 0 5

Seq Scan on user_group ug_1 (cost=0.00..1.10 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=5)

  • Filter: (id = du_2.user_group_id)
  • Rows Removed by Filter: 8
31. 0.005 0.028 ↓ 2.0 2 1

Sort (cost=4.21..4.22 rows=1 width=16) (actual time=0.028..0.028 rows=2 loops=1)

  • Sort Key: crg.flowdown_rolegroup
  • Sort Method: quicksort Memory: 25kB
32. 0.007 0.023 ↓ 2.0 2 1

Bitmap Heap Scan on role_group crg (cost=3.09..4.20 rows=1 width=16) (actual time=0.021..0.023 rows=2 loops=1)

  • Recheck Cond: ((entity_type_id = 15) AND (client_id = 1,002))
  • Heap Blocks: exact=2
33. 0.002 0.016 ↓ 0.0 0 1

BitmapAnd (cost=3.09..3.09 rows=1 width=0) (actual time=0.015..0.016 rows=0 loops=1)

34. 0.006 0.006 ↑ 1.0 9 1

Bitmap Index Scan on role_group_entity_type_id_idx (cost=0.00..1.31 rows=9 width=0) (actual time=0.006..0.006 rows=9 loops=1)

  • Index Cond: (entity_type_id = 15)
35. 0.008 0.008 ↓ 1.8 66 1

Bitmap Index Scan on idx_role_grp_client_id (cost=0.00..1.52 rows=37 width=0) (actual time=0.008..0.008 rows=66 loops=1)

  • Index Cond: (client_id = 1,002)
36. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_app_user on app_user u_1 (cost=0.28..0.32 rows=1 width=17) (never executed)

  • Index Cond: (du_2.user_id = id)
37. 0.000 0.000 ↓ 0.0 0

Index Scan using pk_user_group on user_group ug_4 (cost=0.13..0.15 rows=1 width=278) (never executed)

  • Index Cond: (du_2.user_group_id = id)
38. 0.355 324.420 ↓ 296.0 296 1

Nested Loop Left Join (cost=1,556.01..3,192.66 rows=1 width=311) (actual time=24.250..324.420 rows=296 loops=1)

39. 0.224 324.065 ↓ 296.0 296 1

Nested Loop Left Join (cost=1,555.88..3,192.51 rows=1 width=37) (actual time=24.244..324.065 rows=296 loops=1)

40. 0.266 321.769 ↓ 296.0 296 1

Merge Join (cost=1,555.61..3,192.19 rows=1 width=24) (actual time=24.229..321.769 rows=296 loops=1)

  • Merge Cond: (prg_1.id = crg_1.flowdown_rolegroup)
41. 6.631 321.402 ↓ 12.9 296 1

Nested Loop (cost=1,551.40..39,192.26 rows=23 width=20) (actual time=24.199..321.402 rows=296 loops=1)

  • Join Filter: (du_3.role_group_id = prg_1.id)
  • Rows Removed by Join Filter: 38,756
42. 0.119 0.119 ↓ 1.1 13 1

Index Scan using pk_role_group on role_group prg_1 (cost=0.14..16.83 rows=12 width=4) (actual time=0.006..0.119 rows=13 loops=1)

  • Filter: (entity_type_id = 1)
  • Rows Removed by Filter: 215
43. 6.247 314.652 ↓ 7.3 3,004 13

Materialize (cost=1,551.25..39,102.83 rows=409 width=16) (actual time=1.861..24.204 rows=3,004 loops=13)

44. 1.362 308.405 ↓ 7.3 3,004 1

Nested Loop (cost=1,551.25..39,100.79 rows=409 width=16) (actual time=24.188..308.405 rows=3,004 loops=1)

45. 279.142 293.131 ↓ 1.9 296 1

Bitmap Heap Scan on child_sla et_1 (cost=1,550.83..37,593.27 rows=158 width=8) (actual time=24.124..293.131 rows=296 loops=1)

  • Filter: ((NOT deleted) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date >= '2020-07-24 00:00:00'::timestamp without time zone) AND ((change_tz(reporting_date, 'UTC'::character varying, 'Asia/Kolkata'::character varying))::date <= '2020-09-15 00:00:00'::timestamp without time zone))
  • Rows Removed by Filter: 31,403
  • Heap Blocks: exact=24,733
46. 13.989 13.989 ↓ 5.9 188,456 1

Bitmap Index Scan on idx_child_sla_deleted_client_id_slaid (cost=0.00..1,550.79 rows=31,684 width=0) (actual time=13.989..13.989 rows=188,456 loops=1)

  • Index Cond: (deleted = false)
47. 8.400 13.912 ↓ 3.3 10 296

Index Scan using idx_du_entity_id on domain_user du_3 (cost=0.42..9.51 rows=3 width=16) (actual time=0.037..0.047 rows=10 loops=296)

  • Index Cond: (entity_id = et_1.relation_id)
  • Filter: ((user_id = 1,044) OR (SubPlan 3))
  • Rows Removed by Filter: 19
48.          

SubPlan (for Index Scan)

49. 0.000 5.512 ↓ 0.0 0 5,512

ProjectSet (cost=0.00..1.61 rows=100 width=4) (actual time=0.001..0.001 rows=0 loops=5,512)

50. 5.512 5.512 ↓ 0.0 0 5,512

Seq Scan on user_group ug_2 (cost=0.00..1.10 rows=1 width=32) (actual time=0.001..0.001 rows=0 loops=5,512)

  • Filter: (id = du_3.user_group_id)
  • Rows Removed by Filter: 8
51. 0.078 0.101 ↓ 297.0 297 1

Sort (cost=4.21..4.22 rows=1 width=16) (actual time=0.026..0.101 rows=297 loops=1)

  • Sort Key: crg_1.flowdown_rolegroup
  • Sort Method: quicksort Memory: 25kB
52. 0.007 0.023 ↓ 2.0 2 1

Bitmap Heap Scan on role_group crg_1 (cost=3.09..4.20 rows=1 width=16) (actual time=0.020..0.023 rows=2 loops=1)

  • Recheck Cond: ((entity_type_id = 15) AND (client_id = 1,002))
  • Heap Blocks: exact=2
53. 0.002 0.016 ↓ 0.0 0 1

BitmapAnd (cost=3.09..3.09 rows=1 width=0) (actual time=0.016..0.016 rows=0 loops=1)

54. 0.006 0.006 ↑ 1.0 9 1

Bitmap Index Scan on role_group_entity_type_id_idx (cost=0.00..1.31 rows=9 width=0) (actual time=0.006..0.006 rows=9 loops=1)

  • Index Cond: (entity_type_id = 15)
55. 0.008 0.008 ↓ 1.8 66 1

Bitmap Index Scan on idx_role_grp_client_id (cost=0.00..1.52 rows=37 width=0) (actual time=0.008..0.008 rows=66 loops=1)

  • Index Cond: (client_id = 1,002)
56. 2.072 2.072 ↑ 1.0 1 296

Index Scan using pk_app_user on app_user u_2 (cost=0.28..0.32 rows=1 width=17) (actual time=0.007..0.007 rows=1 loops=296)

  • Index Cond: (du_3.user_id = id)
57. 0.000 0.000 ↓ 0.0 0 296

Index Scan using pk_user_group on user_group ug_5 (cost=0.13..0.15 rows=1 width=278) (actual time=0.000..0.000 rows=0 loops=296)

  • Index Cond: (du_3.user_group_id = id)
58. 0.282 630.594 ↓ 302.0 302 1

Sort (cost=25.07..25.08 rows=1 width=169) (actual time=630.523..630.594 rows=302 loops=1)

  • Sort Key: csla.id, r.name, ets.description, c.name, c.document_title
  • Sort Method: quicksort Memory: 115kB
59. 0.108 630.312 ↓ 302.0 302 1

Nested Loop (cost=4.71..25.06 rows=1 width=169) (actual time=622.250..630.312 rows=302 loops=1)

60. 0.421 629.600 ↓ 302.0 302 1

Nested Loop Left Join (cost=4.43..24.76 rows=1 width=151) (actual time=622.238..629.600 rows=302 loops=1)

61. 0.134 628.291 ↓ 296.0 296 1

Nested Loop Left Join (cost=4.01..23.62 rows=1 width=155) (actual time=622.222..628.291 rows=296 loops=1)

62. 0.109 627.565 ↓ 296.0 296 1

Nested Loop Left Join (cost=3.72..23.06 rows=1 width=109) (actual time=622.208..627.565 rows=296 loops=1)

63. 0.333 626.864 ↓ 296.0 296 1

Nested Loop (cost=3.44..22.73 rows=1 width=62) (actual time=622.194..626.864 rows=296 loops=1)

  • Join Filter: (((du.entity_id = csla.id) AND (du.role_group_id = 2,003) AND (sla.status_id = ANY ('{1511,5,1502,1,1501,1508,1499,1497,1512,1504,6,1500,1510,1509,1496,2,1513,1514,1498,1506,1503,1507,1505,1618,1616,1614,1612,1615,1611,1613,1617}'::integer[]))) OR ((du.entity_id = sla.id) AND (du.role_group_id = 2,002)))
64. 0.460 625.643 ↓ 32.9 296 1

Nested Loop (cost=3.15..18.50 rows=9 width=70) (actual time=622.175..625.643 rows=296 loops=1)

65. 622.815 622.815 ↓ 296.0 296 1

CTE Scan on domain_user_with_flowdown_rgs du (cost=0.00..3.83 rows=1 width=8) (actual time=622.139..622.815 rows=296 loops=1)

  • Filter: (((role_group_id = 2,003) OR (role_group_id = 2,002)) AND ((user_id = 1,044) OR (SubPlan 6)))
  • Rows Removed by Filter: 296
66.          

SubPlan (for CTE Scan)

67. 0.000 0.000 ↓ 0.0 0

ProjectSet (cost=0.00..1.61 rows=100 width=4) (never executed)

68. 0.000 0.000 ↓ 0.0 0

Seq Scan on user_group ug_6 (cost=0.00..1.10 rows=1 width=32) (never executed)

  • Filter: (id = du.user_group_id)
69. 0.888 2.368 ↑ 9.0 1 296

Bitmap Heap Scan on child_sla csla (cost=3.15..14.57 rows=9 width=62) (actual time=0.008..0.008 rows=1 loops=296)

  • Recheck Cond: ((du.entity_id = id) OR ((du.entity_id = slaid) AND (client_id = 1,002) AND (NOT deleted)))
  • Filter: ((NOT deleted) AND (client_id = 1,002) AND (status_id = ANY ('{1628,1626,1621,1620,1622,1627,1623,1624,1625,1619,1568,1,1566,2,4,1567,1563,1564,1565,1562,21}'::integer[])))
  • Heap Blocks: exact=361
70. 0.296 1.480 ↓ 0.0 0 296

BitmapOr (cost=3.15..3.15 rows=10 width=0) (actual time=0.005..0.005 rows=0 loops=296)

71. 0.592 0.592 ↑ 1.0 1 296

Bitmap Index Scan on pk_child_sla (cost=0.00..1.52 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=296)

  • Index Cond: (du.entity_id = id)
72. 0.592 0.592 ↓ 0.0 0 296

Bitmap Index Scan on idx_child_sla_deleted_client_id_slaid (cost=0.00..1.63 rows=9 width=0) (actual time=0.002..0.002 rows=0 loops=296)

  • Index Cond: ((du.entity_id = slaid) AND (client_id = 1,002) AND (deleted = false))
73. 0.888 0.888 ↑ 1.0 1 296

Index Scan using pk_sla on sla (cost=0.29..0.41 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=296)

  • Index Cond: (id = csla.slaid)
  • Filter: (client_id = 1,002)
74. 0.592 0.592 ↑ 1.0 1 296

Index Scan using pk_relation on relation r (cost=0.28..0.32 rows=1 width=55) (actual time=0.002..0.002 rows=1 loops=296)

  • Index Cond: (id = csla.relation_id)
75. 0.592 0.592 ↑ 1.0 1 296

Index Scan using pk_contract on contract c (cost=0.29..0.56 rows=1 width=54) (actual time=0.002..0.002 rows=1 loops=296)

  • Index Cond: (id = csla.contract_id)
76. 0.888 0.888 ↑ 1.0 1 296

Index Only Scan using idx_link_entity_function_6 on link_entity_function lef (cost=0.42..1.13 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=296)

  • Index Cond: ((entity_id = sla.id) AND (entity_type_id = 14))
  • Heap Fetches: 320
77. 0.604 0.604 ↑ 1.0 1 302

Index Scan using pk_work_flow_status on work_flow_status ets (cost=0.28..0.30 rows=1 width=22) (actual time=0.002..0.002 rows=1 loops=302)

  • Index Cond: (id = csla.status_id)
78.          

SubPlan (for Group)

79. 0.592 13.912 ↑ 1.0 1 296

Aggregate (cost=2.91..2.92 rows=1 width=32) (actual time=0.047..0.047 rows=1 loops=296)

80. 0.888 13.320 ↓ 2.0 2 296

Nested Loop (cost=0.14..2.90 rows=1 width=1,310) (actual time=0.016..0.045 rows=2 loops=296)

81. 11.840 11.840 ↓ 2.0 2 296

CTE Scan on domain_user_with_flowdown_rgs du_4 (cost=0.00..0.09 rows=1 width=1,314) (actual time=0.013..0.040 rows=2 loops=296)

  • Filter: (entity_id = csla.id)
  • Rows Removed by Filter: 590
82. 0.592 0.592 ↑ 1.0 1 592

Index Scan using pk_role_group on role_group rg_1 (cost=0.14..2.37 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=592)

  • Index Cond: (id = du_4.role_group_id)
  • Filter: (entity_type_id = 15)
Planning time : 7.300 ms
Execution time : 648.340 ms