explain.depesz.com

PostgreSQL's explain analyze made readable

Result: flSD

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 226,788.371 ↓ 10.0 10 1

Limit (cost=749,650,661.86..749,650,661.86 rows=1 width=950) (actual time=226,788.369..226,788.371 rows=10 loops=1)

2. 0.479 226,788.370 ↓ 10.0 10 1

Sort (cost=749,650,661.86..749,650,661.86 rows=1 width=950) (actual time=226,788.368..226,788.370 rows=10 loops=1)

  • Sort Key: tickets.created_at
  • Sort Method: quicksort Memory: 28kB
3. 0.025 226,787.891 ↓ 10.0 10 1

Nested Loop (cost=25,252,715.84..749,650,661.85 rows=1 width=950) (actual time=224,349.750..226,787.891 rows=10 loops=1)

4. 0.103 226,787.786 ↓ 10.0 10 1

Nested Loop (cost=25,252,715.57..749,650,660.45 rows=1 width=954) (actual time=224,349.722..226,787.786 rows=10 loops=1)

5. 0.839 226,787.593 ↓ 10.0 10 1

Nested Loop (cost=25,252,714.02..749,650,657.76 rows=1 width=954) (actual time=224,349.693..226,787.593 rows=10 loops=1)

6. 1,636.985 226,786.644 ↑ 110.5 10 1

Index Scan using index_tickets_on_status_nulls_first on tickets (cost=25,252,712.46..749,647,678.73 rows=1,105 width=950) (actual time=224,349.031..226,786.644 rows=10 loops=1)

  • Index Cond: ((status)::text = ANY ('{assigned_to_pool,assigned_to_pool_operator,follow_up,waiting_for_client_feedback}'::text[]))
  • Filter: ((NOT ('{"Competenza Tre da Business"}'::character varying[] && tags)) AND ((SubPlan 3) OR (SubPlan 4) OR ((SubPlan 5) AND (SubPlan 6) AND (SubPlan 7)) OR (SubPlan 8)))
  • Rows Removed by Filter: 1,514
7.          

SubPlan (for Index Scan)

8. 103.209 50,111.269 ↑ 2,917.8 1,520 1,523

Materialize (cost=4,224,902.73..4,408,544.73 rows=4,435,120 width=4) (actual time=32.835..32.903 rows=1,520 loops=1,523)

9. 0.145 50,008.060 ↑ 2,917.8 1,520 1

Subquery Scan on items_3 (cost=4,224,902.73..4,369,044.13 rows=4,435,120 width=4) (actual time=50,007.381..50,008.060 rows=1,520 loops=1)

10. 0.318 50,007.915 ↑ 2,917.8 1,520 1

Unique (cost=4,224,902.73..4,324,692.93 rows=4,435,120 width=1,092) (actual time=50,007.378..50,007.915 rows=1,520 loops=1)

11. 21.691 50,007.597 ↑ 2,917.8 1,520 1

Sort (cost=4,224,902.73..4,235,990.53 rows=4,435,120 width=1,092) (actual time=50,007.378..50,007.597 rows=1,520 loops=1)

  • Sort Key: items_4.id, items_4.type, items_4.ticket_id, items_4.author_type, items_4.author_id, items_4.body, items_4.created_at, items_4.updated_at
  • Sort Method: quicksort Memory: 443kB
12. 0.365 49,985.906 ↑ 2,917.8 1,520 1

Append (cost=67,159.51..1,249,156.97 rows=4,435,120 width=1,092) (actual time=36,070.985..49,985.906 rows=1,520 loops=1)

13. 2.815 43,487.079 ↑ 2,274.6 1,520 1

Hash Semi Join (cost=67,159.51..736,123.24 rows=3,457,363 width=205) (actual time=36,070.984..43,487.079 rows=1,520 loops=1)

  • Hash Cond: (items_4.source_id = sources_1.id)
14. 567.405 43,483.959 ↑ 2,599.3 1,520 1

Merge Semi Join (cost=67,144.81..687,274.08 rows=3,950,971 width=209) (actual time=36,069.662..43,483.959 rows=1,520 loops=1)

  • Merge Cond: (items_4.author_id = social_profiles.id)
15. 26,535.262 26,535.262 ↑ 1.0 3,880,503 1

Index Scan using test_items_authors_social_profile on items items_4 (cost=0.43..524,884.34 rows=3,952,684 width=209) (actual time=0.149..26,535.262 rows=3,880,503 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
16. 0.835 16,381.292 ↑ 1,714.3 589 1

Materialize (cost=4.07..116,146.51 rows=1,009,731 width=4) (actual time=11,360.297..16,381.292 rows=589 loops=1)

17. 685.974 16,380.457 ↑ 1,714.3 589 1

Nested Loop Semi Join (cost=4.07..113,622.18 rows=1,009,731 width=4) (actual time=11,359.973..16,380.457 rows=589 loops=1)

18. 7,995.073 7,995.073 ↓ 1.0 1,539,882 1

Index Scan using social_profiles_pkey on social_profiles (cost=0.43..63,303.36 rows=1,535,767 width=8) (actual time=0.020..7,995.073 rows=1,539,882 loops=1)

19. 1,538.704 7,699.410 ↓ 0.0 0 1,539,882

Hash Semi Join (cost=3.65..3.67 rows=1 width=15) (actual time=0.005..0.005 rows=0 loops=1,539,882)

  • Hash Cond: (client_users.id = client_users_1.id)
20. 1.182 1.182 ↑ 1.0 1 591

Index Only Scan using client_users_pkey on client_users (cost=0.43..0.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=591)

  • Index Cond: (id = social_profiles.client_user_id)
  • Heap Fetches: 72
21. 0.000 6,159.524 ↓ 0.0 0 1,539,881

Hash (cost=3.21..3.21 rows=1 width=11) (actual time=0.004..0.004 rows=0 loops=1,539,881)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
22. 1,537.835 6,159.524 ↓ 0.0 0 1,539,881

Hash Semi Join (cost=3.18..3.21 rows=1 width=11) (actual time=0.004..0.004 rows=0 loops=1,539,881)

  • Hash Cond: (client_users_1.id = (custom_field_values.binded_key)::integer)
23. 4,619.643 4,619.643 ↑ 1.0 1 1,539,881

Index Only Scan using client_users_pkey on client_users client_users_1 (cost=0.43..0.45 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1,539,881)

  • Index Cond: (id = social_profiles.client_user_id)
  • Heap Fetches: 186,451
24. 1.527 2.046 ↓ 147.2 589 1

Hash (cost=2.71..2.71 rows=4 width=7) (actual time=2.046..2.046 rows=589 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 31kB
25. 0.519 0.519 ↓ 147.2 589 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values (cost=0.42..2.71 rows=4 width=7) (actual time=0.069..0.519 rows=589 loops=1)

  • Index Cond: ((custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid) AND (value IS NULL))
  • Heap Fetches: 18
26. 0.219 0.305 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.305..0.305 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
27. 0.086 0.086 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_1 (cost=0.27..13.64 rows=85 width=4) (actual time=0.029..0.086 rows=58 loops=1)

  • Heap Fetches: 24
28. 0.121 6,498.462 ↓ 0.0 0 1

Hash Semi Join (cost=79,987.74..468,682.52 rows=977,757 width=205) (actual time=6,498.462..6,498.462 rows=0 loops=1)

  • Hash Cond: (items_5.source_id = sources_2.id)
29. 175.749 6,498.076 ↓ 0.0 0 1

Merge Semi Join (cost=79,973.04..454,857.23 rows=1,117,351 width=209) (actual time=6,498.076..6,498.076 rows=0 loops=1)

  • Merge Cond: (items_5.author_id = client_users_3.id)
30. 3,965.508 3,965.508 ↓ 1.1 1,237,180 1

Index Scan using test_items_authors_client_user on items items_5 (cost=0.43..402,406.60 rows=1,117,835 width=209) (actual time=0.223..3,965.508 rows=1,237,180 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
31. 0.424 2,356.819 ↑ 1,110.6 589 1

Materialize (cost=3.61..69,102.48 rows=654,140 width=15) (actual time=1,658.689..2,356.819 rows=589 loops=1)

32. 733.304 2,356.395 ↑ 1,110.6 589 1

Nested Loop Semi Join (cost=3.61..67,467.13 rows=654,140 width=15) (actual time=1,658.495..2,356.395 rows=589 loops=1)

33. 296.853 296.853 ↓ 1.0 1,326,238 1

Index Only Scan using client_users_pkey on client_users client_users_2 (cost=0.43..23,674.74 rows=1,308,280 width=4) (actual time=0.015..296.853 rows=1,326,238 loops=1)

  • Heap Fetches: 178,972
34. 0.000 1,326.238 ↓ 0.0 0 1,326,238

Hash Semi Join (cost=3.18..3.21 rows=1 width=11) (actual time=0.001..0.001 rows=0 loops=1,326,238)

  • Hash Cond: (client_users_3.id = (custom_field_values_1.binded_key)::integer)
35. 1,326.238 1,326.238 ↑ 1.0 1 1,326,238

Index Only Scan using client_users_pkey on client_users client_users_3 (cost=0.43..0.45 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=1,326,238)

  • Index Cond: (id = client_users_2.id)
  • Heap Fetches: 178,969
36. 0.934 1.151 ↓ 147.2 589 1

Hash (cost=2.71..2.71 rows=4 width=7) (actual time=1.151..1.151 rows=589 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 31kB
37. 0.217 0.217 ↓ 147.2 589 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values custom_field_values_1 (cost=0.42..2.71 rows=4 width=7) (actual time=0.024..0.217 rows=589 loops=1)

  • Index Cond: ((custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid) AND (value IS NULL))
  • Heap Fetches: 18
38. 0.014 0.265 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.265..0.265 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
39. 0.251 0.251 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_2 (cost=0.27..13.64 rows=85 width=4) (actual time=0.212..0.251 rows=58 loops=1)

  • Heap Fetches: 27
40. 40.347 31,852.022 ↑ 7,441.5 596 1,523

Materialize (cost=4,205,486.61..4,389,128.61 rows=4,435,120 width=4) (actual time=20.887..20.914 rows=596 loops=1,523)

41. 0.101 31,811.675 ↑ 7,441.5 596 1

Subquery Scan on items_6 (cost=4,205,486.61..4,349,628.01 rows=4,435,120 width=4) (actual time=31,811.230..31,811.675 rows=596 loops=1)

42. 0.200 31,811.574 ↑ 7,441.5 596 1

Unique (cost=4,205,486.61..4,305,276.81 rows=4,435,120 width=1,092) (actual time=31,811.228..31,811.574 rows=596 loops=1)

43. 15.195 31,811.374 ↑ 7,441.5 596 1

Sort (cost=4,205,486.61..4,216,574.41 rows=4,435,120 width=1,092) (actual time=31,811.227..31,811.374 rows=596 loops=1)

  • Sort Key: items_7.id, items_7.type, items_7.ticket_id, items_7.author_type, items_7.author_id, items_7.body, items_7.created_at, items_7.updated_at
  • Sort Method: quicksort Memory: 186kB
44. 0.141 31,796.179 ↑ 7,441.5 596 1

Append (cost=67,166.02..1,229,740.85 rows=4,435,120 width=1,092) (actual time=18,487.456..31,796.179 rows=596 loops=1)

45. 1.123 20,369.534 ↑ 5,800.9 596 1

Hash Semi Join (cost=67,166.02..736,129.75 rows=3,457,363 width=205) (actual time=18,487.455..20,369.534 rows=596 loops=1)

  • Hash Cond: (items_7.source_id = sources_3.id)
46. 643.127 20,367.983 ↑ 6,629.1 596 1

Merge Semi Join (cost=67,151.31..687,280.59 rows=3,950,971 width=209) (actual time=18,486.431..20,367.983 rows=596 loops=1)

  • Merge Cond: (items_7.author_id = social_profiles_1.id)
47. 11,634.015 11,634.015 ↓ 1.1 4,393,122 1

Index Scan using test_items_authors_social_profile on items items_7 (cost=0.43..524,884.34 rows=3,952,684 width=209) (actual time=0.250..11,634.015 rows=4,393,122 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
48. 0.238 8,090.841 ↑ 3,698.6 273 1

Materialize (cost=10.58..116,153.02 rows=1,009,731 width=4) (actual time=7,141.386..8,090.841 rows=273 loops=1)

49. 888.017 8,090.603 ↑ 3,698.6 273 1

Nested Loop Semi Join (cost=10.58..113,628.69 rows=1,009,731 width=4) (actual time=7,141.295..8,090.603 rows=273 loops=1)

50. 2,582.940 2,582.940 ↓ 1.0 1,539,882 1

Index Scan using social_profiles_pkey on social_profiles social_profiles_1 (cost=0.43..63,303.36 rows=1,535,767 width=8) (actual time=0.015..2,582.940 rows=1,539,882 loops=1)

51. 1,539.609 4,619.646 ↓ 0.0 0 1,539,882

Hash Semi Join (cost=10.15..10.18 rows=1 width=15) (actual time=0.003..0.003 rows=0 loops=1,539,882)

  • Hash Cond: (client_users_4.id = client_users_5.id)
52. 0.275 0.275 ↑ 1.0 1 275

Index Only Scan using client_users_pkey on client_users client_users_4 (cost=0.43..0.45 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=275)

  • Index Cond: (id = social_profiles_1.client_user_id)
  • Heap Fetches: 15
53. 0.000 3,079.762 ↓ 0.0 0 1,539,881

Hash (cost=9.71..9.71 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,539,881)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
54. 0.000 3,079.762 ↓ 0.0 0 1,539,881

Hash Semi Join (cost=9.69..9.71 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,539,881)

  • Hash Cond: (client_users_5.id = (custom_field_values_2.binded_key)::integer)
55. 3,079.762 3,079.762 ↑ 1.0 1 1,539,881

Index Only Scan using client_users_pkey on client_users client_users_5 (cost=0.43..0.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1,539,881)

  • Index Cond: (id = social_profiles_1.client_user_id)
  • Heap Fetches: 186,439
56. 0.689 0.916 ↓ 7.0 273 1

Hash (cost=8.78..8.78 rows=39 width=7) (actual time=0.916..0.916 rows=273 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
57. 0.227 0.227 ↓ 7.0 273 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values custom_field_values_2 (cost=0.42..8.78 rows=39 width=7) (actual time=0.038..0.227 rows=273 loops=1)

  • Index Cond: ((custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid) AND (value = ''::text))
  • Heap Fetches: 79
58. 0.284 0.428 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.428..0.428 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
59. 0.144 0.144 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_3 (cost=0.27..13.64 rows=85 width=4) (actual time=0.109..0.144 rows=58 loops=1)

  • Heap Fetches: 27
60. 0.000 11,426.504 ↓ 0.0 0 1

Nested Loop Semi Join (cost=25.29..449,259.89 rows=977,757 width=205) (actual time=11,426.504..11,426.504 rows=0 loops=1)

61. 672.051 6,391.639 ↓ 1.3 1,278,021 1

Hash Semi Join (cost=15.13..416,237.87 rows=978,180 width=205) (actual time=0.866..6,391.639 rows=1,278,021 loops=1)

  • Hash Cond: (items_8.source_id = sources_4.id)
62. 5,719.253 5,719.253 ↓ 1.1 1,278,021 1

Index Scan using test_items_authors_client_user on items items_8 (cost=0.43..402,406.60 rows=1,117,835 width=209) (actual time=0.036..5,719.253 rows=1,278,021 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
63. 0.099 0.335 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.335..0.335 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
64. 0.236 0.236 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_4 (cost=0.27..13.64 rows=85 width=4) (actual time=0.207..0.236 rows=58 loops=1)

  • Heap Fetches: 26
65. 2,556.033 5,112.084 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=10.16..10.18 rows=1 width=15) (actual time=0.004..0.004 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_6.id = client_users_7.id)
66. 0.009 0.009 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users client_users_6 (cost=0.43..0.45 rows=1 width=4) (actual time=0.009..0.009 rows=1 loops=1)

  • Index Cond: (id = items_8.author_id)
  • Heap Fetches: 0
67. 0.000 2,556.042 ↓ 0.0 0 1,278,021

Hash (cost=9.72..9.72 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,278,021)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
68. 0.000 2,556.042 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=9.69..9.72 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_7.id = (custom_field_values_3.binded_key)::integer)
69. 2,556.042 2,556.042 ↑ 1.0 1 1,278,021

Index Only Scan using client_users_pkey on client_users client_users_7 (cost=0.43..0.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=1,278,021)

  • Index Cond: (id = items_8.author_id)
  • Heap Fetches: 209,400
70. 0.421 0.965 ↓ 7.0 273 1

Hash (cost=8.78..8.78 rows=39 width=7) (actual time=0.965..0.965 rows=273 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 19kB
71. 0.544 0.544 ↓ 7.0 273 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values custom_field_values_3 (cost=0.42..8.78 rows=39 width=7) (actual time=0.036..0.544 rows=273 loops=1)

  • Index Cond: ((custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid) AND (value = ''::text))
  • Heap Fetches: 79
72. 225.223 120,639.876 ↑ 1,357.1 3,268 1,523

Materialize (cost=4,205,615.52..4,389,257.52 rows=4,435,120 width=4) (actual time=79.063..79.212 rows=3,268 loops=1,523)

73. 0.375 120,414.653 ↑ 1,357.1 3,268 1

Subquery Scan on items_9 (cost=4,205,615.52..4,349,756.92 rows=4,435,120 width=4) (actual time=120,413.008..120,414.653 rows=3,268 loops=1)

74. 0.757 120,414.278 ↑ 1,357.1 3,268 1

Unique (cost=4,205,615.52..4,305,405.72 rows=4,435,120 width=1,092) (actual time=120,413.008..120,414.278 rows=3,268 loops=1)

75. 7.524 120,413.521 ↑ 1,357.1 3,268 1

Sort (cost=4,205,615.52..4,216,703.32 rows=4,435,120 width=1,092) (actual time=120,413.006..120,413.521 rows=3,268 loops=1)

  • Sort Key: items_10.id, items_10.type, items_10.ticket_id, items_10.author_type, items_10.author_id, items_10.body, items_10.created_at, items_10.updated_at
  • Sort Method: quicksort Memory: 862kB
76. 0.600 120,405.997 ↑ 1,357.1 3,268 1

Append (cost=67,230.48..1,229,869.76 rows=4,435,120 width=1,092) (actual time=40,231.734..120,405.997 rows=3,268 loops=1)

77. 3.385 93,350.149 ↑ 1,057.9 3,268 1

Hash Semi Join (cost=67,230.48..736,194.21 rows=3,457,363 width=205) (actual time=40,231.732..93,350.149 rows=3,268 loops=1)

  • Hash Cond: (items_10.source_id = sources_5.id)
78. 629.296 93,346.347 ↑ 1,209.0 3,268 1

Merge Semi Join (cost=67,215.77..687,345.04 rows=3,950,971 width=209) (actual time=40,230.619..93,346.347 rows=3,268 loops=1)

  • Merge Cond: (items_10.author_id = social_profiles_2.id)
79. 14,463.218 14,463.218 ↓ 1.1 4,499,589 1

Index Scan using test_items_authors_social_profile on items items_10 (cost=0.43..524,884.34 rows=3,952,684 width=209) (actual time=0.561..14,463.218 rows=4,499,589 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
80. 1.043 78,253.833 ↑ 1,055.1 957 1

Materialize (cost=75.04..116,217.48 rows=1,009,731 width=4) (actual time=27,557.769..78,253.833 rows=957 loops=1)

81. 918.442 78,252.790 ↑ 1,055.1 957 1

Nested Loop Semi Join (cost=75.04..113,693.15 rows=1,009,731 width=4) (actual time=27,557.560..78,252.790 rows=957 loops=1)

82. 3,420.012 3,420.012 ↓ 1.0 1,539,882 1

Index Scan using social_profiles_pkey on social_profiles social_profiles_2 (cost=0.43..63,303.36 rows=1,535,767 width=8) (actual time=0.017..3,420.012 rows=1,539,882 loops=1)

83. 1,538.011 73,914.336 ↓ 0.0 0 1,539,882

Hash Semi Join (cost=74.61..74.63 rows=1 width=15) (actual time=0.048..0.048 rows=0 loops=1,539,882)

  • Hash Cond: (client_users_8.id = client_users_9.id)
84. 1.918 1.918 ↑ 1.0 1 959

Index Only Scan using client_users_pkey on client_users client_users_8 (cost=0.43..0.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=959)

  • Index Cond: (id = social_profiles_2.client_user_id)
  • Heap Fetches: 87
85. 0.000 72,374.407 ↓ 0.0 0 1,539,881

Hash (cost=74.17..74.17 rows=1 width=11) (actual time=0.047..0.047 rows=0 loops=1,539,881)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
86. 1,532.217 72,374.407 ↓ 0.0 0 1,539,881

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (actual time=0.047..0.047 rows=0 loops=1,539,881)

  • Hash Cond: (client_users_9.id = (custom_field_values_4.binded_key)::integer)
87. 7.664 7.664 ↑ 1.0 1 958

Index Only Scan using client_users_pkey on client_users client_users_9 (cost=0.43..0.45 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=958)

  • Index Cond: (id = social_profiles_2.client_user_id)
  • Heap Fetches: 87
88. 1,539.881 70,834.526 ↓ 0.0 0 1,539,881

Hash (cost=73.55..73.55 rows=14 width=7) (actual time=0.046..0.046 rows=0 loops=1,539,881)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
89. 0.000 69,294.645 ↓ 0.0 0 1,539,881

Bitmap Heap Scan on custom_field_values custom_field_values_4 (cost=72.13..73.55 rows=14 width=7) (actual time=0.045..0.045 rows=0 loops=1,539,881)

  • Recheck Cond: (((binded_key)::integer = social_profiles_2.client_user_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'Large'::text))
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=1,648
90. 655.051 69,294.645 ↓ 0.0 0 1,539,881

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (actual time=0.045..0.045 rows=0 loops=1,539,881)

91. 3,079.762 3,079.762 ↑ 3,725.0 1 1,539,881

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (actual time=0.002..0.002 rows=1 loops=1,539,881)

  • Index Cond: ((binded_key)::integer = social_profiles_2.client_user_id)
92. 65,559.832 65,559.832 ↑ 1.7 1,648 387,928

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (actual time=0.169..0.169 rows=1,648 loops=387,928)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
93. 0.358 0.417 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.417..0.417 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
94. 0.059 0.059 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_5 (cost=0.27..13.64 rows=85 width=4) (actual time=0.016..0.059 rows=58 loops=1)

  • Heap Fetches: 26
95. 943.838 27,055.248 ↓ 0.0 0 1

Nested Loop Semi Join (cost=89.75..449,324.35 rows=977,757 width=205) (actual time=27,055.248..27,055.248 rows=0 loops=1)

96. 635.516 6,941.095 ↓ 1.3 1,278,021 1

Hash Semi Join (cost=15.13..416,237.87 rows=978,180 width=205) (actual time=0.275..6,941.095 rows=1,278,021 loops=1)

  • Hash Cond: (items_11.source_id = sources_6.id)
97. 6,305.522 6,305.522 ↓ 1.1 1,278,021 1

Index Scan using test_items_authors_client_user on items items_11 (cost=0.43..402,406.60 rows=1,117,835 width=209) (actual time=0.205..6,305.522 rows=1,278,021 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
98. 0.006 0.057 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.057..0.057 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
99. 0.051 0.051 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_6 (cost=0.27..13.64 rows=85 width=4) (actual time=0.011..0.051 rows=58 loops=1)

  • Heap Fetches: 33
100. 1,278.010 19,170.315 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=74.61..74.64 rows=1 width=15) (actual time=0.015..0.015 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_10.id = client_users_11.id)
101. 0.011 0.011 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users client_users_10 (cost=0.43..0.45 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (id = items_11.author_id)
  • Heap Fetches: 0
102. 0.000 17,892.294 ↓ 0.0 0 1,278,021

Hash (cost=74.17..74.17 rows=1 width=11) (actual time=0.014..0.014 rows=0 loops=1,278,021)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
103. 2,556.039 17,892.294 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (actual time=0.014..0.014 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_11.id = (custom_field_values_5.binded_key)::integer)
104. 0.003 0.003 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users client_users_11 (cost=0.43..0.45 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=1)

  • Index Cond: (id = items_11.author_id)
  • Heap Fetches: 0
105. 0.000 15,336.252 ↓ 0.0 0 1,278,021

Hash (cost=73.55..73.55 rows=14 width=7) (actual time=0.012..0.012 rows=0 loops=1,278,021)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
106. 0.000 15,336.252 ↓ 0.0 0 1,278,021

Bitmap Heap Scan on custom_field_values custom_field_values_5 (cost=72.13..73.55 rows=14 width=7) (actual time=0.012..0.012 rows=0 loops=1,278,021)

  • Recheck Cond: (((binded_key)::integer = items_11.author_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'Large'::text))
107. 1,473.457 15,336.252 ↓ 0.0 0 1,278,021

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (actual time=0.012..0.012 rows=0 loops=1,278,021)

108. 1,278.021 1,278.021 ↓ 0.0 0 1,278,021

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (actual time=0.001..0.001 rows=0 loops=1,278,021)

  • Index Cond: ((binded_key)::integer = items_11.author_id)
109. 12,584.774 12,584.774 ↑ 1.7 1,648 70,306

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (actual time=0.179..0.179 rows=1,648 loops=70,306)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
110. 0.000 0.000 ↓ 0.0 0

Materialize (cost=4,205,615.52..4,389,257.52 rows=4,435,120 width=4) (never executed)

111. 0.000 0.000 ↓ 0.0 0

Subquery Scan on items_12 (cost=4,205,615.52..4,349,756.92 rows=4,435,120 width=4) (never executed)

112. 0.000 0.000 ↓ 0.0 0

Unique (cost=4,205,615.52..4,305,405.72 rows=4,435,120 width=1,092) (never executed)

113. 0.000 0.000 ↓ 0.0 0

Sort (cost=4,205,615.52..4,216,703.32 rows=4,435,120 width=1,092) (never executed)

  • Sort Key: items_13.id, items_13.type, items_13.ticket_id, items_13.author_type, items_13.author_id, items_13.body, items_13.created_at, items_13.updated_at
114. 0.000 0.000 ↓ 0.0 0

Append (cost=67,230.48..1,229,869.76 rows=4,435,120 width=1,092) (never executed)

115. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=67,230.48..736,194.21 rows=3,457,363 width=205) (never executed)

  • Hash Cond: (items_13.source_id = sources_7.id)
116. 0.000 0.000 ↓ 0.0 0

Merge Semi Join (cost=67,215.77..687,345.04 rows=3,950,971 width=209) (never executed)

  • Merge Cond: (items_13.author_id = social_profiles_3.id)
117. 0.000 0.000 ↓ 0.0 0

Index Scan using test_items_authors_social_profile on items items_13 (cost=0.43..524,884.34 rows=3,952,684 width=209) (never executed)

  • Index Cond: ((type)::text = 'Message'::text)
118. 0.000 0.000 ↓ 0.0 0

Materialize (cost=75.04..116,217.48 rows=1,009,731 width=4) (never executed)

119. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=75.04..113,693.15 rows=1,009,731 width=4) (never executed)

120. 0.000 0.000 ↓ 0.0 0

Index Scan using social_profiles_pkey on social_profiles social_profiles_3 (cost=0.43..63,303.36 rows=1,535,767 width=8) (never executed)

121. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.61..74.63 rows=1 width=15) (never executed)

  • Hash Cond: (client_users_12.id = client_users_13.id)
122. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_12 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = social_profiles_3.client_user_id)
  • Heap Fetches: 0
123. 0.000 0.000 ↓ 0.0 0

Hash (cost=74.17..74.17 rows=1 width=11) (never executed)

124. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (never executed)

  • Hash Cond: (client_users_13.id = (custom_field_values_6.binded_key)::integer)
125. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_13 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = social_profiles_3.client_user_id)
  • Heap Fetches: 0
126. 0.000 0.000 ↓ 0.0 0

Hash (cost=73.54..73.54 rows=14 width=7) (never executed)

127. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_6 (cost=72.13..73.54 rows=14 width=7) (never executed)

  • Recheck Cond: (((binded_key)::integer = social_profiles_3.client_user_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'SME'::text))
128. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (never executed)

129. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (never executed)

  • Index Cond: ((binded_key)::integer = social_profiles_3.client_user_id)
130. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (never executed)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
131. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.64..13.64 rows=85 width=4) (never executed)

132. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_7 (cost=0.27..13.64 rows=85 width=4) (never executed)

  • Heap Fetches: 0
133. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=89.74..449,324.35 rows=977,757 width=205) (never executed)

134. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=15.13..416,237.87 rows=978,180 width=205) (never executed)

  • Hash Cond: (items_14.source_id = sources_8.id)
135. 0.000 0.000 ↓ 0.0 0

Index Scan using test_items_authors_client_user on items items_14 (cost=0.43..402,406.60 rows=1,117,835 width=209) (never executed)

  • Index Cond: ((type)::text = 'Message'::text)
136. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.64..13.64 rows=85 width=4) (never executed)

137. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_8 (cost=0.27..13.64 rows=85 width=4) (never executed)

  • Heap Fetches: 0
138. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.61..74.64 rows=1 width=15) (never executed)

  • Hash Cond: (client_users_14.id = client_users_15.id)
139. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_14 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = items_14.author_id)
  • Heap Fetches: 0
140. 0.000 0.000 ↓ 0.0 0

Hash (cost=74.17..74.17 rows=1 width=11) (never executed)

141. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (never executed)

  • Hash Cond: (client_users_15.id = (custom_field_values_7.binded_key)::integer)
142. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_15 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = items_14.author_id)
  • Heap Fetches: 0
143. 0.000 0.000 ↓ 0.0 0

Hash (cost=73.55..73.55 rows=14 width=7) (never executed)

144. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_7 (cost=72.13..73.55 rows=14 width=7) (never executed)

  • Recheck Cond: (((binded_key)::integer = items_14.author_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'SME'::text))
145. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (never executed)

146. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (never executed)

  • Index Cond: ((binded_key)::integer = items_14.author_id)
147. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (never executed)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
148. 0.000 0.000 ↓ 0.0 0

Materialize (cost=4,205,615.52..4,389,257.52 rows=4,435,120 width=4) (never executed)

149. 0.000 0.000 ↓ 0.0 0

Subquery Scan on items_15 (cost=4,205,615.52..4,349,756.92 rows=4,435,120 width=4) (never executed)

150. 0.000 0.000 ↓ 0.0 0

Unique (cost=4,205,615.52..4,305,405.72 rows=4,435,120 width=1,092) (never executed)

151. 0.000 0.000 ↓ 0.0 0

Sort (cost=4,205,615.52..4,216,703.32 rows=4,435,120 width=1,092) (never executed)

  • Sort Key: items_16.id, items_16.type, items_16.ticket_id, items_16.author_type, items_16.author_id, items_16.body, items_16.created_at, items_16.updated_at
152. 0.000 0.000 ↓ 0.0 0

Append (cost=67,230.48..1,229,869.76 rows=4,435,120 width=1,092) (never executed)

153. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=67,230.48..736,194.21 rows=3,457,363 width=205) (never executed)

  • Hash Cond: (items_16.source_id = sources_9.id)
154. 0.000 0.000 ↓ 0.0 0

Merge Semi Join (cost=67,215.77..687,345.04 rows=3,950,971 width=209) (never executed)

  • Merge Cond: (items_16.author_id = social_profiles_4.id)
155. 0.000 0.000 ↓ 0.0 0

Index Scan using test_items_authors_social_profile on items items_16 (cost=0.43..524,884.34 rows=3,952,684 width=209) (never executed)

  • Index Cond: ((type)::text = 'Message'::text)
156. 0.000 0.000 ↓ 0.0 0

Materialize (cost=75.04..116,217.48 rows=1,009,731 width=4) (never executed)

157. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=75.04..113,693.15 rows=1,009,731 width=4) (never executed)

158. 0.000 0.000 ↓ 0.0 0

Index Scan using social_profiles_pkey on social_profiles social_profiles_4 (cost=0.43..63,303.36 rows=1,535,767 width=8) (never executed)

159. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.61..74.63 rows=1 width=15) (never executed)

  • Hash Cond: (client_users_16.id = client_users_17.id)
160. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_16 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = social_profiles_4.client_user_id)
  • Heap Fetches: 0
161. 0.000 0.000 ↓ 0.0 0

Hash (cost=74.17..74.17 rows=1 width=11) (never executed)

162. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (never executed)

  • Hash Cond: (client_users_17.id = (custom_field_values_8.binded_key)::integer)
163. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_17 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = social_profiles_4.client_user_id)
  • Heap Fetches: 0
164. 0.000 0.000 ↓ 0.0 0

Hash (cost=73.55..73.55 rows=14 width=7) (never executed)

165. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_8 (cost=72.13..73.55 rows=14 width=7) (never executed)

  • Recheck Cond: (((binded_key)::integer = social_profiles_4.client_user_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'E&O'::text))
166. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (never executed)

167. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (never executed)

  • Index Cond: ((binded_key)::integer = social_profiles_4.client_user_id)
168. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (never executed)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
169. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.64..13.64 rows=85 width=4) (never executed)

170. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_9 (cost=0.27..13.64 rows=85 width=4) (never executed)

  • Heap Fetches: 0
171. 0.000 0.000 ↓ 0.0 0

Nested Loop Semi Join (cost=89.75..449,324.35 rows=977,757 width=205) (never executed)

172. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=15.13..416,237.87 rows=978,180 width=205) (never executed)

  • Hash Cond: (items_17.source_id = sources_10.id)
173. 0.000 0.000 ↓ 0.0 0

Index Scan using test_items_authors_client_user on items items_17 (cost=0.43..402,406.60 rows=1,117,835 width=209) (never executed)

  • Index Cond: ((type)::text = 'Message'::text)
174. 0.000 0.000 ↓ 0.0 0

Hash (cost=13.64..13.64 rows=85 width=4) (never executed)

175. 0.000 0.000 ↓ 0.0 0

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_10 (cost=0.27..13.64 rows=85 width=4) (never executed)

  • Heap Fetches: 0
176. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.61..74.64 rows=1 width=15) (never executed)

  • Hash Cond: (client_users_18.id = client_users_19.id)
177. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_18 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = items_17.author_id)
  • Heap Fetches: 0
178. 0.000 0.000 ↓ 0.0 0

Hash (cost=74.17..74.17 rows=1 width=11) (never executed)

179. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=74.15..74.17 rows=1 width=11) (never executed)

  • Hash Cond: (client_users_19.id = (custom_field_values_9.binded_key)::integer)
180. 0.000 0.000 ↓ 0.0 0

Index Only Scan using client_users_pkey on client_users client_users_19 (cost=0.43..0.45 rows=1 width=4) (never executed)

  • Index Cond: (id = items_17.author_id)
  • Heap Fetches: 0
181. 0.000 0.000 ↓ 0.0 0

Hash (cost=73.55..73.55 rows=14 width=7) (never executed)

182. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_9 (cost=72.13..73.55 rows=14 width=7) (never executed)

  • Recheck Cond: (((binded_key)::integer = items_17.author_id) AND (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid))
  • Filter: ((deleted_at IS NULL) AND (value <> 'E&O'::text))
183. 0.000 0.000 ↓ 0.0 0

BitmapAnd (cost=72.13..72.13 rows=14 width=0) (never executed)

184. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_binded_key_integer (cost=0.00..28.36 rows=3,725 width=0) (never executed)

  • Index Cond: ((binded_key)::integer = items_17.author_id)
185. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on test_cfv_cf_id_and_value (cost=0.00..42.80 rows=2,863 width=0) (never executed)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
186. 575.739 22,546.492 ↑ 516.8 8,582 1,523

Materialize (cost=4,205,476.13..4,389,118.13 rows=4,435,120 width=4) (actual time=14.423..14.804 rows=8,582 loops=1,523)

187. 0.854 21,970.753 ↑ 516.8 8,582 1

Subquery Scan on items_18 (cost=4,205,476.13..4,349,617.53 rows=4,435,120 width=4) (actual time=21,966.839..21,970.753 rows=8,582 loops=1)

188. 1.672 21,969.899 ↑ 516.8 8,582 1

Unique (cost=4,205,476.13..4,305,266.33 rows=4,435,120 width=1,092) (actual time=21,966.838..21,969.899 rows=8,582 loops=1)

189. 17.317 21,968.227 ↑ 516.8 8,582 1

Sort (cost=4,205,476.13..4,216,563.93 rows=4,435,120 width=1,092) (actual time=21,966.838..21,968.227 rows=8,582 loops=1)

  • Sort Key: items_19.id, items_19.type, items_19.ticket_id, items_19.author_type, items_19.author_id, items_19.body, items_19.created_at, items_19.updated_at
  • Sort Method: quicksort Memory: 2,229kB
190. 0.697 21,950.910 ↑ 516.8 8,582 1

Append (cost=67,160.78..1,229,730.37 rows=4,435,120 width=1,092) (actual time=13,953.520..21,950.910 rows=8,582 loops=1)

191. 2.416 14,888.195 ↑ 402.9 8,582 1

Hash Semi Join (cost=67,160.78..736,124.51 rows=3,457,363 width=205) (actual time=13,953.518..14,888.195 rows=8,582 loops=1)

  • Hash Cond: (items_19.source_id = sources_11.id)
192. 622.641 14,885.633 ↑ 460.4 8,582 1

Merge Semi Join (cost=67,146.08..687,275.35 rows=3,950,971 width=209) (actual time=13,953.356..14,885.633 rows=8,582 loops=1)

  • Merge Cond: (items_19.author_id = social_profiles_5.id)
193. 7,524.990 7,524.990 ↓ 1.1 4,525,868 1

Index Scan using test_items_authors_social_profile on items items_19 (cost=0.43..524,884.34 rows=3,952,684 width=209) (actual time=0.126..7,524.990 rows=4,525,868 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
194. 0.533 6,738.002 ↑ 295.1 3,422 1

Materialize (cost=5.34..116,147.78 rows=1,009,731 width=4) (actual time=6,267.611..6,738.002 rows=3,422 loops=1)

195. 446.420 6,737.469 ↑ 295.1 3,422 1

Nested Loop Semi Join (cost=5.34..113,623.45 rows=1,009,731 width=4) (actual time=6,267.608..6,737.469 rows=3,422 loops=1)

196. 1,671.403 1,671.403 ↓ 1.0 1,539,882 1

Index Scan using social_profiles_pkey on social_profiles social_profiles_5 (cost=0.43..63,303.36 rows=1,535,767 width=8) (actual time=0.020..1,671.403 rows=1,539,882 loops=1)

197. 1,536.460 4,619.646 ↓ 0.0 0 1,539,882

Hash Semi Join (cost=4.91..4.94 rows=1 width=15) (actual time=0.003..0.003 rows=0 loops=1,539,882)

  • Hash Cond: (client_users_20.id = client_users_21.id)
198. 3.424 3.424 ↑ 1.0 1 3,424

Index Only Scan using client_users_pkey on client_users client_users_20 (cost=0.43..0.45 rows=1 width=4) (actual time=0.001..0.001 rows=1 loops=3,424)

  • Index Cond: (id = social_profiles_5.client_user_id)
  • Heap Fetches: 541
199. 0.000 3,079.762 ↓ 0.0 0 1,539,881

Hash (cost=4.47..4.47 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,539,881)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
200. 0.000 3,079.762 ↓ 0.0 0 1,539,881

Hash Semi Join (cost=4.45..4.47 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,539,881)

  • Hash Cond: (client_users_21.id = (custom_field_values_10.binded_key)::integer)
201. 3,079.762 3,079.762 ↑ 1.0 1 1,539,881

Index Only Scan using client_users_pkey on client_users client_users_21 (cost=0.43..0.45 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=1,539,881)

  • Index Cond: (id = social_profiles_5.client_user_id)
  • Heap Fetches: 186,533
202. 2.751 4.864 ↓ 342.2 3,422 1

Hash (cost=3.90..3.90 rows=10 width=7) (actual time=4.864..4.864 rows=3,422 loops=1)

  • Buckets: 4,096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 166kB
203. 2.113 2.113 ↓ 342.2 3,422 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values custom_field_values_10 (cost=0.42..3.90 rows=10 width=7) (actual time=0.028..2.113 rows=3,422 loops=1)

  • Index Cond: ((custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid) AND (value = 'Business TRE'::text))
  • Heap Fetches: 1,339
204. 0.020 0.146 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.146..0.146 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
205. 0.126 0.126 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_11 (cost=0.27..13.64 rows=85 width=4) (actual time=0.079..0.126 rows=58 loops=1)

  • Heap Fetches: 54
206. 596.458 7,062.018 ↓ 0.0 0 1

Nested Loop Semi Join (cost=20.05..449,254.65 rows=977,757 width=205) (actual time=7,062.018..7,062.018 rows=0 loops=1)

207. 686.911 2,631.497 ↓ 1.3 1,278,021 1

Hash Semi Join (cost=15.13..416,237.87 rows=978,180 width=205) (actual time=0.312..2,631.497 rows=1,278,021 loops=1)

  • Hash Cond: (items_20.source_id = sources_12.id)
208. 1,944.482 1,944.482 ↓ 1.1 1,278,021 1

Index Scan using test_items_authors_client_user on items items_20 (cost=0.43..402,406.60 rows=1,117,835 width=209) (actual time=0.030..1,944.482 rows=1,278,021 loops=1)

  • Index Cond: ((type)::text = 'Message'::text)
209. 0.016 0.104 ↑ 1.5 58 1

Hash (cost=13.64..13.64 rows=85 width=4) (actual time=0.104..0.104 rows=58 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
210. 0.088 0.088 ↑ 1.5 58 1

Index Only Scan using index_sources_on_id_and_workspace_id on sources sources_12 (cost=0.27..13.64 rows=85 width=4) (actual time=0.013..0.088 rows=58 loops=1)

  • Heap Fetches: 54
211. 1,278.010 3,834.063 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=4.92..4.94 rows=1 width=15) (actual time=0.003..0.003 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_22.id = client_users_23.id)
212. 0.011 0.011 ↑ 1.0 1 1

Index Only Scan using client_users_pkey on client_users client_users_22 (cost=0.43..0.45 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=1)

  • Index Cond: (id = items_20.author_id)
  • Heap Fetches: 0
213. 0.000 2,556.042 ↓ 0.0 0 1,278,021

Hash (cost=4.48..4.48 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,278,021)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
214. 0.000 2,556.042 ↓ 0.0 0 1,278,021

Hash Semi Join (cost=4.45..4.48 rows=1 width=11) (actual time=0.002..0.002 rows=0 loops=1,278,021)

  • Hash Cond: (client_users_23.id = (custom_field_values_11.binded_key)::integer)
215. 2,556.042 2,556.042 ↑ 1.0 1 1,278,021

Index Only Scan using client_users_pkey on client_users client_users_23 (cost=0.43..0.45 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=1,278,021)

  • Index Cond: (id = items_20.author_id)
  • Heap Fetches: 209,590
216. 1.431 4.283 ↓ 342.2 3,422 1

Hash (cost=3.90..3.90 rows=10 width=7) (actual time=4.283..4.283 rows=3,422 loops=1)

  • Buckets: 4,096 (originally 1024) Batches: 1 (originally 1) Memory Usage: 166kB
217. 2.852 2.852 ↓ 342.2 3,422 1

Index Only Scan using test_cfv_deleted_null_value_cf_id_binded_key on custom_field_values custom_field_values_11 (cost=0.42..3.90 rows=10 width=7) (actual time=0.034..2.852 rows=3,422 loops=1)

  • Index Cond: ((custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid) AND (value = 'Business TRE'::text))
  • Heap Fetches: 1,339
218. 0.000 0.110 ↑ 1.0 1 10

Index Only Scan using index_items_on_source_id_and_id on items (cost=1.56..2.69 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=10)

  • Index Cond: ((source_id = 44) AND (id = (SubPlan 1)))
  • Heap Fetches: 10
219.          

SubPlan (for Index Only Scan)

220. 0.270 0.430 ↑ 1.0 1 10

Limit (cost=0.43..1.12 rows=1 width=12) (actual time=0.043..0.043 rows=1 loops=10)

221. 0.160 0.160 ↑ 13.0 1 10

Index Scan using index_items_on_ticket_id_and_created_at on items items_1 (cost=0.43..9.38 rows=13 width=12) (actual time=0.016..0.016 rows=1 loops=10)

  • Index Cond: (ticket_id = tickets.id)
  • Filter: ((type)::text = 'Message'::text)
222. 0.030 0.090 ↑ 1.0 1 10

Index Only Scan using items_pkey on items last_message (cost=1.56..2.68 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=10)

  • Index Cond: (id = (SubPlan 2))
  • Heap Fetches: 10
223.          

SubPlan (for Index Only Scan)

224. 0.010 0.060 ↑ 1.0 1 10

Limit (cost=0.43..1.12 rows=1 width=12) (actual time=0.006..0.006 rows=1 loops=10)

225. 0.050 0.050 ↑ 13.0 1 10

Index Scan Backward using index_items_on_ticket_id_and_created_at on items items_2 (cost=0.43..9.38 rows=13 width=12) (actual time=0.005..0.005 rows=1 loops=10)

  • Index Cond: (ticket_id = tickets.id)
  • Filter: ((type)::text = 'Message'::text)
226. 0.080 0.080 ↑ 1.0 1 10

Index Only Scan using index_sources_on_id_and_cached_label on sources (cost=0.27..1.39 rows=1 width=4) (actual time=0.008..0.008 rows=1 loops=10)

  • Index Cond: (id = 44)
  • Heap Fetches: 10
Planning time : 56.347 ms
Execution time : 226,796.031 ms