explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gTmB

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 5,129.707 ↑ 1.0 40 1

Limit (cost=31,576,495.98..31,584,857.81 rows=40 width=76) (actual time=5,128.733..5,129.707 rows=40 loops=1)

  • Buffers: shared hit=478,046, temp read=1,063 written=1,150
2.          

CTE filtered_accounts_cte

3. 14.630 181.858 ↑ 1.5 35,856 1

Hash Join (cost=73,196.49..1,568,434.48 rows=55,530 width=40) (actual time=153.495..181.858 rows=35,856 loops=1)

  • Hash Cond: (t1401_accountfact.sid = t2268_accountdim.sid)
  • Buffers: shared hit=54,567, temp read=190 written=188
4. 14.134 25.778 ↑ 1.1 35,856 1

Bitmap Heap Scan on t1401_accountfact (cost=13,897.51..1,503,241.29 rows=38,721 width=4) (actual time=11.769..25.778 rows=35,856 loops=1)

  • Recheck Cond: ((end_stamp > '1593172558000'::bigint) AND (start_stamp <= '1593172558000'::bigint))
  • Filter: ((NOT deleted) AND ((alternatives: SubPlan 1 or hashed SubPlan 2) OR (alternatives: SubPlan 3 or hashed SubPlan 4)))
  • Rows Removed by Filter: 23,736
  • Heap Blocks: exact=1,137
  • Buffers: shared hit=3,558
5. 11.293 11.293 ↑ 1.0 59,616 1

Bitmap Index Scan on idx_933_t1401_accountfact_sid_end_stamp_start_stamp_null (cost=0.00..13,887.83 rows=61,341 width=0) (actual time=11.293..11.293 rows=59,616 loops=1)

  • Index Cond: ((end_stamp > '1593172558000'::bigint) AND (start_stamp <= '1593172558000'::bigint))
  • Buffers: shared hit=2,318
6.          

SubPlan (for Bitmap Heap Scan)

7. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..15.78 rows=1 width=0) (never executed)

  • Hash Cond: (t859_userroledim.sid = t786_userrolehierarchy.c4812_user_role_id)
8. 0.000 0.000 ↓ 0.0 0

Seq Scan on t859_userroledim (cost=0.00..7.35 rows=29 width=4) (never executed)

  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND ((c4994_portaltype IS NULL) OR (c4994_portaltype = 'None'::text)) AND (end_stamp = '32503680000000'::bigint))
9. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

10. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_37_t786_userrolehierarchy_sid_c4815_ancestor_role_id_end_st on t786_userrolehierarchy (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Index Cond: ((sid = t1401_accountfact.c7136_ownerid) AND (c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
11. 0.099 0.290 ↓ 1.5 359 1

Hash Join (cost=23.72..97.23 rows=246 width=4) (actual time=0.101..0.290 rows=359 loops=1)

  • Hash Cond: (t786_userrolehierarchy_1.c4812_user_role_id = t859_userroledim_1.sid)
  • Buffers: shared hit=76
12. 0.114 0.145 ↑ 1.0 359 1

Bitmap Heap Scan on t786_userrolehierarchy t786_userrolehierarchy_1 (cost=16.01..88.47 rows=364 width=8) (actual time=0.045..0.145 rows=359 loops=1)

  • Recheck Cond: ((c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
  • Heap Blocks: exact=62
  • Buffers: shared hit=70
13. 0.031 0.031 ↑ 1.0 359 1

Bitmap Index Scan on idx_35_t786_userrolehierarchy_c4815_ancestor_role_id_end_stamp_ (cost=0.00..15.92 rows=364 width=0) (actual time=0.031..0.031 rows=359 loops=1)

  • Index Cond: ((c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
  • Buffers: shared hit=8
14. 0.007 0.046 ↓ 1.5 44 1

Hash (cost=7.35..7.35 rows=29 width=4) (actual time=0.046..0.046 rows=44 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=6
15. 0.039 0.039 ↓ 1.5 44 1

Seq Scan on t859_userroledim t859_userroledim_1 (cost=0.00..7.35 rows=29 width=4) (actual time=0.005..0.039 rows=44 loops=1)

  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND ((c4994_portaltype IS NULL) OR (c4994_portaltype = 'None'::text)) AND (end_stamp = '32503680000000'::bigint))
  • Rows Removed by Filter: 84
  • Buffers: shared hit=6
16. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_14_t773_userdim_sid_end_stamp_start_stamp_null on t773_userdim (cost=0.28..8.30 rows=1 width=0) (never executed)

  • Index Cond: ((sid = t1401_accountfact.c7136_ownerid) AND (end_stamp = '32503680000000'::bigint))
  • Filter: ((NOT deleted) AND (c4570_userroleid IS NULL) AND (sid <> '-2'::integer) AND (c4581_usertype = 'Standard'::text))
17. 0.039 0.061 ↑ 2.5 27 1

Bitmap Heap Scan on t773_userdim t773_userdim_1 (cost=4.98..53.05 rows=68 width=4) (actual time=0.033..0.061 rows=27 loops=1)

  • Recheck Cond: ((c4570_userroleid IS NULL) AND (end_stamp = '32503680000000'::bigint))
  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND (c4581_usertype = 'Standard'::text))
  • Rows Removed by Filter: 9
  • Heap Blocks: exact=23
  • Buffers: shared hit=27
18. 0.022 0.022 ↑ 1.9 36 1

Bitmap Index Scan on idx_15_t773_userdim_c4570_userroleid_end_stamp_start_stamp_null (cost=0.00..4.97 rows=69 width=0) (actual time=0.022..0.022 rows=36 loops=1)

  • Index Cond: ((c4570_userroleid IS NULL) AND (end_stamp = '32503680000000'::bigint))
  • Buffers: shared hit=4
19. 9.752 141.450 ↑ 2.1 35,941 1

Hash (cost=57,786.71..57,786.71 rows=74,422 width=40) (actual time=141.450..141.450 rows=35,941 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,801kB
  • Buffers: shared hit=51,009, temp written=134
20. 131.698 131.698 ↑ 2.1 35,941 1

Seq Scan on t2268_accountdim (cost=0.00..57,786.71 rows=74,422 width=40) (actual time=0.004..131.698 rows=35,941 loops=1)

  • Filter: ((NOT deleted) AND (start_stamp <= '1593172558000'::bigint) AND (end_stamp > '1593172558000'::bigint))
  • Rows Removed by Filter: 438,189
  • Buffers: shared hit=51,009
21.          

CTE account_activity_count_cte_meeting_current

22. 4.505 102.662 ↓ 1.1 1,861 1

Unique (cost=1,731,261.89..1,731,527.63 rows=1,710 width=4) (actual time=92.150..102.662 rows=1,861 loops=1)

  • Buffers: shared hit=5,110, temp read=117 written=118
23. 38.774 98.157 ↓ 1.3 67,811 1

Sort (cost=1,731,261.89..1,731,394.76 rows=53,149 width=4) (actual time=92.149..98.157 rows=67,811 loops=1)

  • Sort Key: t2273_meetingactivityaccountfact.c9010_accountid
  • Sort Method: external merge Disk: 936kB
  • Buffers: shared hit=5,110, temp read=117 written=118
24. 59.041 59.383 ↓ 1.3 67,811 1

Index Scan using "idx_activitydate_issharedp_del_P_sentha" on t2273_meetingactivityaccountfact (cost=0.42..1,727,090.29 rows=53,149 width=4) (actual time=0.375..59.383 rows=67,811 loops=1)

  • Index Cond: ((c8986_activitydate >= '1561532400000'::bigint) AND (c8986_activitydate < '1593241200000'::bigint) AND (end_stamp > '1593173652000'::bigint) AND (start_stamp <= '1593173652000'::bigint))
  • Filter: ((alternatives: SubPlan 6 or hashed SubPlan 7) OR (alternatives: SubPlan 8 or hashed SubPlan 9))
  • Rows Removed by Filter: 6,979
  • Buffers: shared hit=5,110
25.          

SubPlan (for Index Scan)

26. 0.000 0.000 ↓ 0.0 0

Hash Join (cost=8.32..15.78 rows=1 width=0) (never executed)

  • Hash Cond: (t859_userroledim_2.sid = t786_userrolehierarchy_2.c4812_user_role_id)
27. 0.000 0.000 ↓ 0.0 0

Seq Scan on t859_userroledim t859_userroledim_2 (cost=0.00..7.35 rows=29 width=4) (never executed)

  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND ((c4994_portaltype IS NULL) OR (c4994_portaltype = 'None'::text)) AND (end_stamp = '32503680000000'::bigint))
28. 0.000 0.000 ↓ 0.0 0

Hash (cost=8.30..8.30 rows=1 width=4) (never executed)

29. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_37_t786_userrolehierarchy_sid_c4815_ancestor_role_id_end_st on t786_userrolehierarchy t786_userrolehierarchy_2 (cost=0.28..8.30 rows=1 width=4) (never executed)

  • Index Cond: ((sid = t2273_meetingactivityaccountfact.c9004_activityownersfuserid) AND (c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
30. 0.096 0.290 ↓ 1.5 359 1

Hash Join (cost=23.72..97.23 rows=246 width=4) (actual time=0.098..0.290 rows=359 loops=1)

  • Hash Cond: (t786_userrolehierarchy_3.c4812_user_role_id = t859_userroledim_3.sid)
  • Buffers: shared hit=76
31. 0.117 0.149 ↑ 1.0 359 1

Bitmap Heap Scan on t786_userrolehierarchy t786_userrolehierarchy_3 (cost=16.01..88.47 rows=364 width=8) (actual time=0.046..0.149 rows=359 loops=1)

  • Recheck Cond: ((c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
  • Heap Blocks: exact=62
  • Buffers: shared hit=70
32. 0.032 0.032 ↑ 1.0 359 1

Bitmap Index Scan on idx_35_t786_userrolehierarchy_c4815_ancestor_role_id_end_stamp_ (cost=0.00..15.92 rows=364 width=0) (actual time=0.032..0.032 rows=359 loops=1)

  • Index Cond: ((c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
  • Buffers: shared hit=8
33. 0.006 0.045 ↓ 1.5 44 1

Hash (cost=7.35..7.35 rows=29 width=4) (actual time=0.045..0.045 rows=44 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
  • Buffers: shared hit=6
34. 0.039 0.039 ↓ 1.5 44 1

Seq Scan on t859_userroledim t859_userroledim_3 (cost=0.00..7.35 rows=29 width=4) (actual time=0.005..0.039 rows=44 loops=1)

  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND ((c4994_portaltype IS NULL) OR (c4994_portaltype = 'None'::text)) AND (end_stamp = '32503680000000'::bigint))
  • Rows Removed by Filter: 84
  • Buffers: shared hit=6
35. 0.000 0.000 ↓ 0.0 0

Index Scan using idx_14_t773_userdim_sid_end_stamp_start_stamp_null on t773_userdim t773_userdim_2 (cost=0.28..8.30 rows=1 width=0) (never executed)

  • Index Cond: ((sid = t2273_meetingactivityaccountfact.c9004_activityownersfuserid) AND (end_stamp = '32503680000000'::bigint))
  • Filter: ((NOT deleted) AND (c4570_userroleid IS NULL) AND (sid <> '-2'::integer) AND (c4581_usertype = 'Standard'::text))
36. 0.038 0.052 ↑ 2.5 27 1

Bitmap Heap Scan on t773_userdim t773_userdim_3 (cost=4.98..53.05 rows=68 width=4) (actual time=0.023..0.052 rows=27 loops=1)

  • Recheck Cond: ((c4570_userroleid IS NULL) AND (end_stamp = '32503680000000'::bigint))
  • Filter: ((NOT deleted) AND (sid <> '-2'::integer) AND (c4581_usertype = 'Standard'::text))
  • Rows Removed by Filter: 9
  • Heap Blocks: exact=23
  • Buffers: shared hit=27
37. 0.014 0.014 ↑ 1.9 36 1

Bitmap Index Scan on idx_15_t773_userdim_c4570_userroleid_end_stamp_start_stamp_null (cost=0.00..4.97 rows=69 width=0) (actual time=0.014..0.014 rows=36 loops=1)

  • Index Cond: ((c4570_userroleid IS NULL) AND (end_stamp = '32503680000000'::bigint))
  • Buffers: shared hit=4
38. 0.459 5,129.701 ↑ 138.8 40 1

GroupAggregate (cost=28,276,533.86..29,437,365.21 rows=5,553 width=76) (actual time=5,128.732..5,129.701 rows=40 loops=1)

  • Group Key: cte0.c3, cte0.c1
  • Buffers: shared hit=478,046, temp read=1,063 written=1,150
39. 185.954 5,129.242 ↑ 66,942.1 1,734 1

Sort (cost=28,276,533.86..28,566,727.82 rows=116,077,582 width=40) (actual time=5,128.713..5,129.242 rows=1,734 loops=1)

  • Sort Key: cte0.c3, cte0.c1
  • Sort Method: external merge Disk: 4,360kB
  • Buffers: shared hit=478,046, temp read=1,063 written=1,150
40. 23.578 4,943.288 ↑ 868.2 133,693 1

Merge Join (cost=1,457,890.96..3,205,644.86 rows=116,077,582 width=40) (actual time=4,886.016..4,943.288 rows=133,693 loops=1)

  • Merge Cond: (cte0.c1 = t2608_emailactivityaccountfact_copy_sentha.c9638_accountid)
  • Buffers: shared hit=478,046, temp read=603 written=603
41. 15.008 209.126 ↑ 1.5 35,851 1

Sort (cost=5,486.64..5,625.46 rows=55,530 width=36) (actual time=204.588..209.126 rows=35,851 loops=1)

  • Sort Key: cte0.c1
  • Sort Method: quicksort Memory: 3,464kB
  • Buffers: shared hit=54,567, temp read=190 written=188
42. 194.118 194.118 ↑ 1.5 35,856 1

CTE Scan on filtered_accounts_cte cte0 (cost=0.00..1,110.60 rows=55,530 width=36) (actual time=153.498..194.118 rows=35,856 loops=1)

  • Buffers: shared hit=54,567, temp read=190 written=188
43. 15.230 4,710.584 ↑ 18.9 133,896 1

Materialize (cost=1,452,404.32..1,465,030.08 rows=2,525,152 width=8) (actual time=4,681.423..4,710.584 rows=133,896 loops=1)

  • Buffers: shared hit=423,479, temp read=413 written=415
44. 72.701 4,695.354 ↑ 18.9 133,896 1

Sort (cost=1,452,404.32..1,458,717.20 rows=2,525,152 width=8) (actual time=4,681.420..4,695.354 rows=133,896 loops=1)

  • Sort Key: t2608_emailactivityaccountfact_copy_sentha.c9638_accountid
  • Sort Method: external merge Disk: 2,368kB
  • Buffers: shared hit=423,479, temp read=413 written=415
45. 490.758 4,622.653 ↑ 18.9 133,896 1

Hash Anti Join (cost=55.58..1,114,832.43 rows=2,525,152 width=8) (actual time=103.221..4,622.653 rows=133,896 loops=1)

  • Hash Cond: (t2608_emailactivityaccountfact_copy_sentha.c9638_accountid = account_activity_count_cte_meeting_current.c1)
  • Buffers: shared hit=423,479, temp read=117 written=118
46. 4,028.698 4,028.698 ↑ 1.0 4,829,863 1

Seq Scan on t2608_emailactivityaccountfact_copy_sentha (cost=0.00..795,660.76 rows=5,050,305 width=8) (actual time=0.011..4,028.698 rows=4,829,863 loops=1)

  • Filter: ((NOT deleted) AND c9660_isinternalinitiated AND c9657_isshared AND (start_stamp <= '1593172558000'::bigint) AND (end_stamp > '1593172558000'::bigint) AND (c9653_activitydate >= '1561532400000'::bigint) AND (c9653_activitydate < '1593241200000'::bigint))
  • Rows Removed by Filter: 14,034,726
  • Buffers: shared hit=418,369
47. 0.225 103.197 ↓ 1.1 1,861 1

Hash (cost=34.20..34.20 rows=1,710 width=4) (actual time=103.197..103.197 rows=1,861 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 82kB
  • Buffers: shared hit=5,110, temp read=117 written=118
48. 102.972 102.972 ↓ 1.1 1,861 1

CTE Scan on account_activity_count_cte_meeting_current (cost=0.00..34.20 rows=1,710 width=4) (actual time=92.152..102.972 rows=1,861 loops=1)

  • Buffers: shared hit=5,110, temp read=117 written=118
Planning time : 3.666 ms
Execution time : 5,132.683 ms