explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TjZt

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 4,906.740 ↑ 1.0 40 1

Limit (cost=32,121,124.55..32,129,649.96 rows=40 width=76) (actual time=4,905.784..4,906.740 rows=40 loops=1)

  • Buffers: shared hit=488,685, temp read=1,063 written=1,150
2.          

CTE filtered_accounts_cte

3. 14.348 181.814 ↑ 1.5 35,856 1

Hash Join (cost=73,196.49..1,568,434.48 rows=55,530 width=40) (actual time=153.840..181.814 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.037 25.923 ↑ 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=12.008..25.923 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.526 11.526 ↑ 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.526..11.526 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.105 0.297 ↓ 1.5 359 1

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

  • Hash Cond: (t786_userrolehierarchy_1.c4812_user_role_id = t859_userroledim_1.sid)
  • Buffers: shared hit=76
12. 0.116 0.147 ↑ 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.044..0.147 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.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
15. 0.038 0.038 ↓ 1.5 44 1

Seq Scan on t859_userroledim t859_userroledim_1 (cost=0.00..7.35 rows=29 width=4) (actual time=0.004..0.038 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.063 ↑ 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.034..0.063 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.024 0.024 ↑ 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.024..0.024 rows=36 loops=1)

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

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

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,801kB
  • Buffers: shared hit=51,009, temp written=134
20. 131.911 131.911 ↑ 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.911 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.548 103.222 ↓ 1.1 1,861 1

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

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

Sort (cost=1,731,261.89..1,731,394.76 rows=53,149 width=4) (actual time=92.546..98.674 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.270 59.617 ↓ 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.384..59.617 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.097 0.295 ↓ 1.5 359 1

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

  • Hash Cond: (t786_userrolehierarchy_3.c4812_user_role_id = t859_userroledim_3.sid)
  • Buffers: shared hit=76
31. 0.116 0.152 ↑ 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.050..0.152 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.036 0.036 ↑ 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.036..0.036 rows=359 loops=1)

  • Index Cond: ((c4815_ancestor_role_id = 12) AND (end_stamp = '32503680000000'::bigint))
  • Buffers: shared hit=8
33. 0.008 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
34. 0.038 0.038 ↓ 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.038 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.037 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.024..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.015 0.015 ↑ 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.015..0.015 rows=36 loops=1)

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

GroupAggregate (cost=28,821,162.44..30,004,701.33 rows=5,553 width=76) (actual time=4,905.782..4,906.735 rows=40 loops=1)

  • Group Key: cte0.c3, cte0.c1
  • Buffers: shared hit=488,685, temp read=1,063 written=1,150
39. 185.931 4,906.292 ↑ 68,251.6 1,734 1

Sort (cost=28,821,162.44..29,117,033.28 rows=118,348,336 width=40) (actual time=4,905.763..4,906.292 rows=1,734 loops=1)

  • Sort Key: cte0.c3, cte0.c1
  • Sort Method: external merge Disk: 4,360kB
  • Buffers: shared hit=488,685, temp read=1,063 written=1,150
40. 23.801 4,720.361 ↑ 885.2 133,693 1

Merge Join (cost=1,461,511.67..3,243,290.89 rows=118,348,336 width=40) (actual time=4,662.931..4,720.361 rows=133,693 loops=1)

  • Merge Cond: (cte0.c1 = t2608_emailactivityaccountfact.c9638_accountid)
  • Buffers: shared hit=488,685, temp read=603 written=603
41. 14.698 208.702 ↑ 1.5 35,851 1

Sort (cost=5,486.64..5,625.46 rows=55,530 width=36) (actual time=204.197..208.702 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.004 194.004 ↑ 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.842..194.004 rows=35,856 loops=1)

  • Buffers: shared hit=54,567, temp read=190 written=188
43. 15.160 4,487.858 ↑ 18.8 133,896 1

Materialize (cost=1,456,025.03..1,468,578.10 rows=2,510,613 width=8) (actual time=4,458.727..4,487.858 rows=133,896 loops=1)

  • Buffers: shared hit=434,118, temp read=413 written=415
44. 73.507 4,472.698 ↑ 18.8 133,896 1

Sort (cost=1,456,025.03..1,462,301.56 rows=2,510,613 width=8) (actual time=4,458.724..4,472.698 rows=133,896 loops=1)

  • Sort Key: t2608_emailactivityaccountfact.c9638_accountid
  • Sort Method: external merge Disk: 2,368kB
  • Buffers: shared hit=434,118, temp read=413 written=415
45. 494.650 4,399.191 ↑ 18.8 133,896 1

Hash Anti Join (cost=55.58..1,120,495.79 rows=2,510,613 width=8) (actual time=103.791..4,399.191 rows=133,896 loops=1)

  • Hash Cond: (t2608_emailactivityaccountfact.c9638_accountid = account_activity_count_cte_meeting_current.c1)
  • Buffers: shared hit=434,118, temp read=117 written=118
46. 3,800.772 3,800.772 ↑ 1.0 4,829,863 1

Seq Scan on t2608_emailactivityaccountfact (cost=0.00..806,299.76 rows=5,021,226 width=8) (actual time=0.010..3,800.772 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=429,008
47. 0.231 103.769 ↓ 1.1 1,861 1

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

  • Buckets: 2,048 Batches: 1 Memory Usage: 82kB
  • Buffers: shared hit=5,110, temp read=117 written=118
48. 103.538 103.538 ↓ 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.550..103.538 rows=1,861 loops=1)

  • Buffers: shared hit=5,110, temp read=117 written=118
Planning time : 3.470 ms
Execution time : 4,909.767 ms