explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L8cp

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 395,271.659 ↓ 4.7 14 1

Limit (cost=1,310,396,550.80..1,310,396,550.81 rows=3 width=950) (actual time=395,271.655..395,271.659 rows=14 loops=1)

2. 0.117 395,271.657 ↓ 4.7 14 1

Sort (cost=1,310,396,550.80..1,310,396,550.81 rows=3 width=950) (actual time=395,271.654..395,271.657 rows=14 loops=1)

  • Sort Key: tickets.created_at
  • Sort Method: quicksort Memory: 29kB
3. 0.045 395,271.540 ↓ 4.7 14 1

Nested Loop (cost=52,965,152.04..1,310,396,550.78 rows=3 width=950) (actual time=389,189.088..395,271.540 rows=14 loops=1)

4. 0.484 395,270.123 ↓ 4.7 14 1

Nested Loop (cost=52,965,152.04..1,310,396,548.01 rows=3 width=954) (actual time=389,187.747..395,270.123 rows=14 loops=1)

5. 15.246 395,268.015 ↓ 4.7 14 1

Nested Loop (cost=52,965,148.40..1,310,396,513.40 rows=3 width=954) (actual time=389,186.848..395,268.015 rows=14 loops=1)

6. 5,440.125 395,241.639 ↑ 137.6 14 1

Index Scan using index_tickets_on_status_nulls_first on tickets (cost=52,965,144.76..1,310,374,286.84 rows=1,926 width=950) (actual time=389,178.664..395,241.639 rows=14 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: 1673
7.          

SubPlan (for Index Scan)

8. 205.268 84,670.920 ↑ 2,904.9 1,520 1,686

Materialize (cost=8,806,561.78..8,989,388.30 rows=4,415,427 width=4) (actual time=50.099..50.220 rows=1,520 loops=1,686)

9. 0.180 84,465.652 ↑ 2,904.9 1,520 1

Subquery Scan on items_3 (cost=8,806,561.78..8,950,063.16 rows=4,415,427 width=4) (actual time=84,464.658..84,465.652 rows=1,520 loops=1)

10. 0.501 84,465.472 ↑ 2,904.9 1,520 1

Unique (cost=8,806,561.78..8,905,908.89 rows=4,415,427 width=1,092) (actual time=84,464.657..84,465.472 rows=1,520 loops=1)

11. 2.115 84,464.971 ↑ 2,904.9 1,520 1

Sort (cost=8,806,561.78..8,817,600.35 rows=4,415,427 width=1,092) (actual time=84,464.655..84,464.971 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.287 84,462.856 ↑ 2,904.9 1,520 1

Append (cost=178,862.14..1,980,672.42 rows=4,415,427 width=1,092) (actual time=33,330.153..84,462.856 rows=1,520 loops=1)

13. 44,821.615 59,947.941 ↑ 2,262.1 1,520 1

Hash Semi Join (cost=178,862.14..1,173,639.91 rows=3,438,345 width=205) (actual time=33,330.152..59,947.941 rows=1,520 loops=1)

  • Hash Cond: (items_4.author_id = social_profiles.id)
14. 1,467.001 8,983.086 ↓ 1.3 4,530,268 1

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (actual time=0.915..8,983.086 rows=4,530,268 loops=1)

  • Hash Cond: (items_4.source_id = sources_1.id)
15. 7,515.631 7,515.631 ↓ 1.2 4,530,268 1

Seq Scan on items items_4 (cost=0.00..700,065.99 rows=3,932,645 width=209) (actual time=0.444..7,515.631 rows=4,530,268 loops=1)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
  • Rows Removed by Filter: 6341865
16. 0.027 0.454 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.454..0.454 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
17. 0.427 0.427 ↑ 1.0 58 1

Seq Scan on sources sources_1 (cost=0.00..2.58 rows=58 width=4) (actual time=0.386..0.427 rows=58 loops=1)

18. 25.305 6,143.240 ↑ 1,750.5 589 1

Hash (cost=161,942.74..161,942.74 rows=1,031,047 width=4) (actual time=6,143.240..6,143.240 rows=589 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1032kB
19. 2,809.099 6,117.935 ↑ 1,750.5 589 1

Hash Semi Join (cost=86,978.30..161,942.74 rows=1,031,047 width=4) (actual time=3,872.791..6,117.935 rows=589 loops=1)

  • Hash Cond: (social_profiles.client_user_id = client_users_1.id)
20. 508.899 508.899 ↑ 1.0 1,539,489 1

Seq Scan on social_profiles (cost=0.00..44,187.89 rows=1,539,489 width=8) (actual time=0.393..508.899 rows=1,539,489 loops=1)

21. 21.517 2,799.937 ↑ 1,125.5 589 1

Hash (cost=75,454.79..75,454.79 rows=662,921 width=15) (actual time=2,799.937..2,799.937 rows=589 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1027kB
22. 2,272.711 2,778.420 ↑ 1,125.5 589 1

Hash Semi Join (cost=17,907.03..75,454.79 rows=662,921 width=15) (actual time=356.697..2,778.420 rows=589 loops=1)

  • Hash Cond: (client_users.id = client_users_1.id)
23. 404.835 404.835 ↑ 1.0 1,325,842 1

Seq Scan on client_users (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.341..404.835 rows=1,325,842 loops=1)

24. 23.412 100.874 ↑ 1,125.5 589 1

Hash (cost=6,383.52..6,383.52 rows=662,921 width=11) (actual time=100.874..100.874 rows=589 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1026kB
25. 0.771 77.462 ↑ 1,125.5 589 1

Nested Loop (cost=6,350.07..6,383.52 rows=662,921 width=11) (actual time=35.293..77.462 rows=589 loops=1)

26. 0.915 35.461 ↓ 147.2 589 1

HashAggregate (cost=6,349.64..6,349.68 rows=4 width=7) (actual time=35.227..35.461 rows=589 loops=1)

  • Group Key: (custom_field_values.binded_key)::integer
27. 33.473 34.546 ↓ 147.2 589 1

Bitmap Heap Scan on custom_field_values (cost=82.78..6,349.63 rows=4 width=7) (actual time=4.103..34.546 rows=589 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value IS NULL))
  • Rows Removed by Filter: 1059
  • Heap Blocks: exact=1331
28. 1.073 1.073 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=1.073..1.073 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
29. 41.230 41.230 ↑ 1.0 1 589

Index Only Scan using client_users_pkey on client_users client_users_1 (cost=0.43..8.45 rows=1 width=4) (actual time=0.068..0.070 rows=1 loops=589)

  • Index Cond: (id = (custom_field_values.binded_key)::integer)
  • Heap Fetches: 589
30. 17,152.687 24,514.628 ↓ 0.0 0 1

Hash Semi Join (cost=123,289.04..762,878.24 rows=977,082 width=205) (actual time=24,514.627..24,514.628 rows=0 loops=1)

  • Hash Cond: (items_5.author_id = client_users_3.id)
31. 436.511 5,096.162 ↓ 1.3 1,277,816 1

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (actual time=471.731..5,096.162 rows=1,277,816 loops=1)

  • Hash Cond: (items_5.source_id = sources_2.id)
32. 4,194.958 4,659.066 ↓ 1.1 1,277,816 1

Bitmap Heap Scan on items items_5 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (actual time=471.115..4,659.066 rows=1,277,816 loops=1)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
  • Rows Removed by Index Recheck: 5822959
  • Heap Blocks: exact=28045 lossy=343645
33. 464.108 464.108 ↓ 1.1 1,277,816 1

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (actual time=464.108..464.108 rows=1,277,816 loops=1)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
34. 0.017 0.585 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.585..0.585 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
35. 0.568 0.568 ↑ 1.0 58 1

Seq Scan on sources sources_2 (cost=0.00..2.58 rows=58 width=4) (actual time=0.560..0.568 rows=58 loops=1)

36. 18.247 2,265.779 ↑ 1,125.5 589 1

Hash (cost=75,454.79..75,454.79 rows=662,921 width=15) (actual time=2,265.779..2,265.779 rows=589 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1033kB
37. 1,986.547 2,247.532 ↑ 1,125.5 589 1

Hash Semi Join (cost=17,907.03..75,454.79 rows=662,921 width=15) (actual time=260.349..2,247.532 rows=589 loops=1)

  • Hash Cond: (client_users_2.id = client_users_3.id)
38. 233.250 233.250 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_2 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.719..233.250 rows=1,325,842 loops=1)

39. 22.831 27.735 ↑ 1,125.5 589 1

Hash (cost=6,383.52..6,383.52 rows=662,921 width=11) (actual time=27.735..27.735 rows=589 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1026kB
40. 0.391 4.904 ↑ 1,125.5 589 1

Nested Loop (cost=6,350.07..6,383.52 rows=662,921 width=11) (actual time=2.637..4.904 rows=589 loops=1)

41. 0.444 2.746 ↓ 147.2 589 1

HashAggregate (cost=6,349.64..6,349.68 rows=4 width=7) (actual time=2.609..2.746 rows=589 loops=1)

  • Group Key: (custom_field_values_1.binded_key)::integer
42. 2.011 2.302 ↓ 147.2 589 1

Bitmap Heap Scan on custom_field_values custom_field_values_1 (cost=82.78..6,349.63 rows=4 width=7) (actual time=0.725..2.302 rows=589 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value IS NULL))
  • Rows Removed by Filter: 1059
  • Heap Blocks: exact=1331
43. 0.291 0.291 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.291..0.291 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
44. 1.767 1.767 ↑ 1.0 1 589

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

  • Index Cond: (id = (custom_field_values_1.binded_key)::integer)
  • Heap Fetches: 589
45. 82.642 138,225.024 ↑ 7,408.4 596 1,686

Materialize (cost=8,807,254.51..8,990,081.02 rows=4,415,427 width=4) (actual time=81.937..81.984 rows=596 loops=1,686)

46. 0.084 138,142.382 ↑ 7,408.4 596 1

Subquery Scan on items_6 (cost=8,807,254.51..8,950,755.89 rows=4,415,427 width=4) (actual time=138,141.971..138,142.382 rows=596 loops=1)

47. 0.243 138,142.298 ↑ 7,408.4 596 1

Unique (cost=8,807,254.51..8,906,601.62 rows=4,415,427 width=1,092) (actual time=138,141.970..138,142.298 rows=596 loops=1)

48. 1.773 138,142.055 ↑ 7,408.4 596 1

Sort (cost=8,807,254.51..8,818,293.08 rows=4,415,427 width=1,092) (actual time=138,141.968..138,142.055 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
49. 0.227 138,140.282 ↑ 7,408.4 596 1

Append (cost=179,208.50..1,981,365.15 rows=4,415,427 width=1,092) (actual time=67,962.573..138,140.282 rows=596 loops=1)

50. 79,201.579 97,942.320 ↑ 5,769.0 596 1

Hash Semi Join (cost=179,208.50..1,173,986.28 rows=3,438,345 width=205) (actual time=67,962.572..97,942.320 rows=596 loops=1)

  • Hash Cond: (items_7.author_id = social_profiles_1.id)
51. 2,326.383 13,462.089 ↓ 1.3 4,530,268 1

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (actual time=1.258..13,462.089 rows=4,530,268 loops=1)

  • Hash Cond: (items_7.source_id = sources_3.id)
52. 11,135.258 11,135.258 ↓ 1.2 4,530,268 1

Seq Scan on items items_7 (cost=0.00..700,065.99 rows=3,932,645 width=209) (actual time=0.748..11,135.258 rows=4,530,268 loops=1)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
  • Rows Removed by Filter: 6341865
53. 0.019 0.448 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.448..0.448 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
54. 0.429 0.429 ↑ 1.0 58 1

Seq Scan on sources sources_3 (cost=0.00..2.58 rows=58 width=4) (actual time=0.413..0.429 rows=58 loops=1)

55. 29.810 5,278.652 ↑ 3,776.7 273 1

Hash (cost=162,289.11..162,289.11 rows=1,031,047 width=4) (actual time=5,278.652..5,278.652 rows=273 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1031kB
56. 2,676.403 5,248.842 ↑ 3,776.7 273 1

Hash Semi Join (cost=87,324.66..162,289.11 rows=1,031,047 width=4) (actual time=3,975.471..5,248.842 rows=273 loops=1)

  • Hash Cond: (social_profiles_1.client_user_id = client_users_5.id)
57. 353.941 353.941 ↑ 1.0 1,539,489 1

Seq Scan on social_profiles social_profiles_1 (cost=0.00..44,187.89 rows=1,539,489 width=8) (actual time=0.510..353.941 rows=1,539,489 loops=1)

58. 25.813 2,218.498 ↑ 2,428.3 273 1

Hash (cost=75,801.15..75,801.15 rows=662,921 width=15) (actual time=2,218.498..2,218.498 rows=273 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1025kB
59. 1,926.123 2,192.685 ↑ 2,428.3 273 1

Hash Semi Join (cost=18,253.40..75,801.15 rows=662,921 width=15) (actual time=388.000..2,192.685 rows=273 loops=1)

  • Hash Cond: (client_users_4.id = client_users_5.id)
60. 234.947 234.947 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_4 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.445..234.947 rows=1,325,842 loops=1)

61. 18.614 31.615 ↑ 2,428.3 273 1

Hash (cost=6,729.88..6,729.88 rows=662,921 width=11) (actual time=31.615..31.615 rows=273 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1025kB
62. 0.290 13.001 ↑ 2,428.3 273 1

Nested Loop (cost=6,357.64..6,729.88 rows=662,921 width=11) (actual time=9.117..13.001 rows=273 loops=1)

63. 0.245 9.162 ↓ 6.2 273 1

HashAggregate (cost=6,357.20..6,357.64 rows=44 width=7) (actual time=9.077..9.162 rows=273 loops=1)

  • Group Key: (custom_field_values_2.binded_key)::integer
64. 8.593 8.917 ↓ 6.2 273 1

Bitmap Heap Scan on custom_field_values custom_field_values_2 (cost=82.79..6,357.09 rows=44 width=7) (actual time=0.522..8.917 rows=273 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value = ''::text))
  • Rows Removed by Filter: 1375
  • Heap Blocks: exact=1331
65. 0.324 0.324 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.324..0.324 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
66. 3.549 3.549 ↑ 1.0 1 273

Index Only Scan using client_users_pkey on client_users client_users_5 (cost=0.43..8.45 rows=1 width=4) (actual time=0.013..0.013 rows=1 loops=273)

  • Index Cond: (id = (custom_field_values_2.binded_key)::integer)
  • Heap Fetches: 273
67. 25,967.396 40,197.735 ↓ 0.0 0 1

Hash Semi Join (cost=123,635.40..763,224.60 rows=977,082 width=205) (actual time=40,197.735..40,197.735 rows=0 loops=1)

  • Hash Cond: (items_8.author_id = client_users_7.id)
68. 624.499 8,838.426 ↓ 1.3 1,277,816 1

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (actual time=1,252.509..8,838.426 rows=1,277,816 loops=1)

  • Hash Cond: (items_8.source_id = sources_4.id)
69. 6,996.580 8,211.429 ↓ 1.1 1,277,816 1

Bitmap Heap Scan on items items_8 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (actual time=1,249.842..8,211.429 rows=1,277,816 loops=1)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
  • Rows Removed by Index Recheck: 5822959
  • Heap Blocks: exact=28045 lossy=343645
70. 1,214.849 1,214.849 ↓ 1.1 1,277,816 1

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (actual time=1,214.849..1,214.849 rows=1,277,816 loops=1)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
71. 0.050 2.498 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=2.498..2.498 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
72. 2.448 2.448 ↑ 1.0 58 1

Seq Scan on sources sources_4 (cost=0.00..2.58 rows=58 width=4) (actual time=2.428..2.448 rows=58 loops=1)

73. 62.677 5,391.913 ↑ 2,428.3 273 1

Hash (cost=75,801.15..75,801.15 rows=662,921 width=15) (actual time=5,391.913..5,391.913 rows=273 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1031kB
74. 4,512.320 5,329.236 ↑ 2,428.3 273 1

Hash Semi Join (cost=18,253.40..75,801.15 rows=662,921 width=15) (actual time=988.325..5,329.236 rows=273 loops=1)

  • Hash Cond: (client_users_6.id = client_users_7.id)
75. 746.341 746.341 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_6 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=2.079..746.341 rows=1,325,842 loops=1)

76. 53.075 70.575 ↑ 2,428.3 273 1

Hash (cost=6,729.88..6,729.88 rows=662,921 width=11) (actual time=70.575..70.575 rows=273 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1025kB
77. 0.632 17.500 ↑ 2,428.3 273 1

Nested Loop (cost=6,357.64..6,729.88 rows=662,921 width=11) (actual time=12.645..17.500 rows=273 loops=1)

78. 0.890 13.046 ↓ 6.2 273 1

HashAggregate (cost=6,357.20..6,357.64 rows=44 width=7) (actual time=12.602..13.046 rows=273 loops=1)

  • Group Key: (custom_field_values_3.binded_key)::integer
79. 11.676 12.156 ↓ 6.2 273 1

Bitmap Heap Scan on custom_field_values custom_field_values_3 (cost=82.79..6,357.09 rows=44 width=7) (actual time=0.899..12.156 rows=273 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value = ''::text))
  • Rows Removed by Filter: 1375
  • Heap Blocks: exact=1331
80. 0.480 0.480 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.480..0.480 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
81. 3.822 3.822 ↑ 1.0 1 273

Index Only Scan using client_users_pkey on client_users client_users_7 (cost=0.43..8.45 rows=1 width=4) (actual time=0.011..0.014 rows=1 loops=273)

  • Index Cond: (id = (custom_field_values_3.binded_key)::integer)
  • Heap Fetches: 273
82. 461.188 86,230.470 ↑ 1,351.1 3,268 1,686

Materialize (cost=8,848,222.52..9,031,049.04 rows=4,415,427 width=4) (actual time=50.871..51.145 rows=3,268 loops=1,686)

83. 0.431 85,769.282 ↑ 1,351.1 3,268 1

Subquery Scan on items_9 (cost=8,848,222.52..8,991,723.90 rows=4,415,427 width=4) (actual time=85,767.535..85,769.282 rows=3,268 loops=1)

84. 0.829 85,768.851 ↑ 1,351.1 3,268 1

Unique (cost=8,848,222.52..8,947,569.63 rows=4,415,427 width=1,092) (actual time=85,767.533..85,768.851 rows=3,268 loops=1)

85. 3.470 85,768.022 ↑ 1,351.1 3,268 1

Sort (cost=8,848,222.52..8,859,261.09 rows=4,415,427 width=1,092) (actual time=85,767.532..85,768.022 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
86. 0.459 85,764.552 ↑ 1,351.1 3,268 1

Append (cost=199,692.51..2,022,333.16 rows=4,415,427 width=1,092) (actual time=20,377.704..85,764.552 rows=3,268 loops=1)

87. 48,390.558 62,274.469 ↑ 1,052.1 3,268 1

Hash Semi Join (cost=199,692.51..1,194,470.28 rows=3,438,345 width=205) (actual time=20,377.703..62,274.469 rows=3,268 loops=1)

  • Hash Cond: (items_10.author_id = social_profiles_2.id)
88. 1,438.266 7,596.630 ↓ 1.3 4,530,268 1

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (actual time=1.793..7,596.630 rows=4,530,268 loops=1)

  • Hash Cond: (items_10.source_id = sources_5.id)
89. 6,157.723 6,157.723 ↓ 1.2 4,530,268 1

Seq Scan on items items_10 (cost=0.00..700,065.99 rows=3,932,645 width=209) (actual time=1.106..6,157.723 rows=4,530,268 loops=1)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
  • Rows Removed by Filter: 6341865
90. 0.011 0.641 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.641..0.641 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
91. 0.630 0.630 ↑ 1.0 58 1

Seq Scan on sources sources_5 (cost=0.00..2.58 rows=58 width=4) (actual time=0.617..0.630 rows=58 loops=1)

92. 34.309 6,287.281 ↑ 1,077.4 957 1

Hash (cost=182,773.11..182,773.11 rows=1,031,047 width=4) (actual time=6,287.281..6,287.281 rows=957 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1032kB
93. 2,985.997 6,252.972 ↑ 1,077.4 957 1

Hash Semi Join (cost=107,808.67..182,773.11 rows=1,031,047 width=4) (actual time=4,217.500..6,252.972 rows=957 loops=1)

  • Hash Cond: (social_profiles_2.client_user_id = client_users_9.id)
94. 468.479 468.479 ↑ 1.0 1,539,489 1

Seq Scan on social_profiles social_profiles_2 (cost=0.00..44,187.89 rows=1,539,489 width=8) (actual time=1.066..468.479 rows=1,539,489 loops=1)

95. 20.907 2,798.496 ↑ 692.7 957 1

Hash (cost=96,285.15..96,285.15 rows=662,921 width=15) (actual time=2,798.496..2,798.496 rows=957 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1027kB
96. 2,428.222 2,777.589 ↑ 692.7 957 1

Hash Semi Join (cost=38,737.40..96,285.15 rows=662,921 width=15) (actual time=549.862..2,777.589 rows=957 loops=1)

  • Hash Cond: (client_users_8.id = client_users_9.id)
97. 234.097 234.097 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_8 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.610..234.097 rows=1,325,842 loops=1)

98. 28.097 115.270 ↑ 692.7 957 1

Hash (cost=27,213.89..27,213.89 rows=662,921 width=11) (actual time=115.270..115.270 rows=957 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1027kB
99. 1.283 87.173 ↑ 692.7 957 1

Nested Loop (cost=6,365.71..27,213.89 rows=662,921 width=11) (actual time=16.710..87.173 rows=957 loops=1)

100. 0.959 16.986 ↑ 3.1 957 1

HashAggregate (cost=6,365.28..6,394.91 rows=2,963 width=7) (actual time=16.631..16.986 rows=957 loops=1)

  • Group Key: (custom_field_values_4.binded_key)::integer
101. 15.509 16.027 ↑ 3.1 957 1

Bitmap Heap Scan on custom_field_values custom_field_values_4 (cost=83.53..6,357.83 rows=2,981 width=7) (actual time=0.766..16.027 rows=957 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value <> 'Large'::text))
  • Rows Removed by Filter: 691
  • Heap Blocks: exact=1331
102. 0.518 0.518 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.518..0.518 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
103. 68.904 68.904 ↑ 1.0 1 957

Index Only Scan using client_users_pkey on client_users client_users_9 (cost=0.43..7.02 rows=1 width=4) (actual time=0.072..0.072 rows=1 loops=957)

  • Index Cond: (id = (custom_field_values_4.binded_key)::integer)
  • Heap Fetches: 957
104. 16,446.253 23,489.624 ↓ 0.0 0 1

Hash Semi Join (cost=144,119.41..783,708.61 rows=977,082 width=205) (actual time=23,489.624..23,489.624 rows=0 loops=1)

  • Hash Cond: (items_11.author_id = client_users_11.id)
105. 451.920 5,082.301 ↓ 1.3 1,277,816 1

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (actual time=350.883..5,082.301 rows=1,277,816 loops=1)

  • Hash Cond: (items_11.source_id = sources_6.id)
106. 4,284.644 4,629.760 ↓ 1.1 1,277,816 1

Bitmap Heap Scan on items items_11 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (actual time=350.227..4,629.760 rows=1,277,816 loops=1)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
  • Rows Removed by Index Recheck: 5822959
  • Heap Blocks: exact=28045 lossy=343645
107. 345.116 345.116 ↓ 1.1 1,277,816 1

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (actual time=345.116..345.116 rows=1,277,816 loops=1)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
108. 0.025 0.621 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.621..0.621 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
109. 0.596 0.596 ↑ 1.0 58 1

Seq Scan on sources sources_6 (cost=0.00..2.58 rows=58 width=4) (actual time=0.586..0.596 rows=58 loops=1)

110. 13.123 1,961.070 ↑ 692.7 957 1

Hash (cost=96,285.15..96,285.15 rows=662,921 width=15) (actual time=1,961.070..1,961.070 rows=957 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1033kB
111. 1,705.078 1,947.947 ↑ 692.7 957 1

Hash Semi Join (cost=38,737.40..96,285.15 rows=662,921 width=15) (actual time=310.981..1,947.947 rows=957 loops=1)

  • Hash Cond: (client_users_10.id = client_users_11.id)
112. 223.943 223.943 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_10 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.640..223.943 rows=1,325,842 loops=1)

113. 13.568 18.926 ↑ 692.7 957 1

Hash (cost=27,213.89..27,213.89 rows=662,921 width=11) (actual time=18.925..18.926 rows=957 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1027kB
114. 0.000 5.358 ↑ 692.7 957 1

Nested Loop (cost=6,365.71..27,213.89 rows=662,921 width=11) (actual time=2.339..5.358 rows=957 loops=1)

115. 0.446 2.498 ↑ 3.1 957 1

HashAggregate (cost=6,365.28..6,394.91 rows=2,963 width=7) (actual time=2.324..2.498 rows=957 loops=1)

  • Group Key: (custom_field_values_5.binded_key)::integer
116. 1.820 2.052 ↑ 3.1 957 1

Bitmap Heap Scan on custom_field_values custom_field_values_5 (cost=83.53..6,357.83 rows=2,981 width=7) (actual time=0.387..2.052 rows=957 loops=1)

  • Recheck Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value <> 'Large'::text))
  • Rows Removed by Filter: 691
  • Heap Blocks: exact=1331
117. 0.232 0.232 ↑ 1.8 1,648 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.232..0.232 rows=1,648 loops=1)

  • Index Cond: (custom_field_id = '5138c474-51e6-4cbe-b0b7-63a2186f3340'::uuid)
118. 2.871 2.871 ↑ 1.0 1 957

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

  • Index Cond: (id = (custom_field_values_5.binded_key)::integer)
  • Heap Fetches: 957
119. 0.000 0.000 ↓ 0.0 0

Materialize (cost=8,848,187.69..9,031,014.20 rows=4,415,427 width=4) (never executed)

120. 0.000 0.000 ↓ 0.0 0

Subquery Scan on items_12 (cost=8,848,187.69..8,991,689.06 rows=4,415,427 width=4) (never executed)

121. 0.000 0.000 ↓ 0.0 0

Unique (cost=8,848,187.69..8,947,534.79 rows=4,415,427 width=1,092) (never executed)

122. 0.000 0.000 ↓ 0.0 0

Sort (cost=8,848,187.69..8,859,226.25 rows=4,415,427 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
123. 0.000 0.000 ↓ 0.0 0

Append (cost=199,675.09..2,022,298.33 rows=4,415,427 width=1,092) (never executed)

124. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=199,675.09..1,194,452.87 rows=3,438,345 width=205) (never executed)

  • Hash Cond: (items_13.author_id = social_profiles_3.id)
125. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (never executed)

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

Seq Scan on items items_13 (cost=0.00..700,065.99 rows=3,932,645 width=209) (never executed)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
127. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.58..2.58 rows=58 width=4) (never executed)

128. 0.000 0.000 ↓ 0.0 0

Seq Scan on sources sources_7 (cost=0.00..2.58 rows=58 width=4) (never executed)

129. 0.000 0.000 ↓ 0.0 0

Hash (cost=182,755.70..182,755.70 rows=1,031,047 width=4) (never executed)

130. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=107,791.25..182,755.70 rows=1,031,047 width=4) (never executed)

  • Hash Cond: (social_profiles_3.client_user_id = client_users_13.id)
131. 0.000 0.000 ↓ 0.0 0

Seq Scan on social_profiles social_profiles_3 (cost=0.00..44,187.89 rows=1,539,489 width=8) (never executed)

132. 0.000 0.000 ↓ 0.0 0

Hash (cost=96,267.74..96,267.74 rows=662,921 width=15) (never executed)

133. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=38,719.99..96,267.74 rows=662,921 width=15) (never executed)

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

Seq Scan on client_users client_users_12 (cost=0.00..33,095.42 rows=1,325,842 width=4) (never executed)

135. 0.000 0.000 ↓ 0.0 0

Hash (cost=27,196.47..27,196.47 rows=662,921 width=11) (never executed)

136. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=6,365.71..27,196.47 rows=662,921 width=11) (never executed)

137. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=6,365.27..6,394.87 rows=2,960 width=7) (never executed)

  • Group Key: (custom_field_values_6.binded_key)::integer
138. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_6 (cost=83.53..6,357.83 rows=2,978 width=7) (never executed)

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

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (never executed)

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

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

  • Index Cond: (id = (custom_field_values_6.binded_key)::integer)
  • Heap Fetches: 0
141. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=144,101.99..783,691.19 rows=977,082 width=205) (never executed)

  • Hash Cond: (items_14.author_id = client_users_15.id)
142. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (never executed)

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

Bitmap Heap Scan on items items_14 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (never executed)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
144. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (never executed)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
145. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.58..2.58 rows=58 width=4) (never executed)

146. 0.000 0.000 ↓ 0.0 0

Seq Scan on sources sources_8 (cost=0.00..2.58 rows=58 width=4) (never executed)

147. 0.000 0.000 ↓ 0.0 0

Hash (cost=96,267.74..96,267.74 rows=662,921 width=15) (never executed)

148. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=38,719.99..96,267.74 rows=662,921 width=15) (never executed)

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

Seq Scan on client_users client_users_14 (cost=0.00..33,095.42 rows=1,325,842 width=4) (never executed)

150. 0.000 0.000 ↓ 0.0 0

Hash (cost=27,196.47..27,196.47 rows=662,921 width=11) (never executed)

151. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=6,365.71..27,196.47 rows=662,921 width=11) (never executed)

152. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=6,365.27..6,394.87 rows=2,960 width=7) (never executed)

  • Group Key: (custom_field_values_7.binded_key)::integer
153. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_7 (cost=83.53..6,357.83 rows=2,978 width=7) (never executed)

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

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (never executed)

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

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

  • Index Cond: (id = (custom_field_values_7.binded_key)::integer)
  • Heap Fetches: 0
156. 0.000 0.000 ↓ 0.0 0

Materialize (cost=8,848,222.52..9,031,049.04 rows=4,415,427 width=4) (never executed)

157. 0.000 0.000 ↓ 0.0 0

Subquery Scan on items_15 (cost=8,848,222.52..8,991,723.90 rows=4,415,427 width=4) (never executed)

158. 0.000 0.000 ↓ 0.0 0

Unique (cost=8,848,222.52..8,947,569.63 rows=4,415,427 width=1,092) (never executed)

159. 0.000 0.000 ↓ 0.0 0

Sort (cost=8,848,222.52..8,859,261.09 rows=4,415,427 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
160. 0.000 0.000 ↓ 0.0 0

Append (cost=199,692.51..2,022,333.16 rows=4,415,427 width=1,092) (never executed)

161. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=199,692.51..1,194,470.28 rows=3,438,345 width=205) (never executed)

  • Hash Cond: (items_16.author_id = social_profiles_4.id)
162. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (never executed)

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

Seq Scan on items items_16 (cost=0.00..700,065.99 rows=3,932,645 width=209) (never executed)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
164. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.58..2.58 rows=58 width=4) (never executed)

165. 0.000 0.000 ↓ 0.0 0

Seq Scan on sources sources_9 (cost=0.00..2.58 rows=58 width=4) (never executed)

166. 0.000 0.000 ↓ 0.0 0

Hash (cost=182,773.11..182,773.11 rows=1,031,047 width=4) (never executed)

167. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=107,808.67..182,773.11 rows=1,031,047 width=4) (never executed)

  • Hash Cond: (social_profiles_4.client_user_id = client_users_17.id)
168. 0.000 0.000 ↓ 0.0 0

Seq Scan on social_profiles social_profiles_4 (cost=0.00..44,187.89 rows=1,539,489 width=8) (never executed)

169. 0.000 0.000 ↓ 0.0 0

Hash (cost=96,285.15..96,285.15 rows=662,921 width=15) (never executed)

170. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=38,737.40..96,285.15 rows=662,921 width=15) (never executed)

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

Seq Scan on client_users client_users_16 (cost=0.00..33,095.42 rows=1,325,842 width=4) (never executed)

172. 0.000 0.000 ↓ 0.0 0

Hash (cost=27,213.89..27,213.89 rows=662,921 width=11) (never executed)

173. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=6,365.71..27,213.89 rows=662,921 width=11) (never executed)

174. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=6,365.28..6,394.91 rows=2,963 width=7) (never executed)

  • Group Key: (custom_field_values_8.binded_key)::integer
175. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_8 (cost=83.53..6,357.83 rows=2,981 width=7) (never executed)

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

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (never executed)

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

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

  • Index Cond: (id = (custom_field_values_8.binded_key)::integer)
  • Heap Fetches: 0
178. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=144,119.41..783,708.61 rows=977,082 width=205) (never executed)

  • Hash Cond: (items_17.author_id = client_users_19.id)
179. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (never executed)

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

Bitmap Heap Scan on items items_17 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (never executed)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
181. 0.000 0.000 ↓ 0.0 0

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (never executed)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
182. 0.000 0.000 ↓ 0.0 0

Hash (cost=2.58..2.58 rows=58 width=4) (never executed)

183. 0.000 0.000 ↓ 0.0 0

Seq Scan on sources sources_10 (cost=0.00..2.58 rows=58 width=4) (never executed)

184. 0.000 0.000 ↓ 0.0 0

Hash (cost=96,285.15..96,285.15 rows=662,921 width=15) (never executed)

185. 0.000 0.000 ↓ 0.0 0

Hash Semi Join (cost=38,737.40..96,285.15 rows=662,921 width=15) (never executed)

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

Seq Scan on client_users client_users_18 (cost=0.00..33,095.42 rows=1,325,842 width=4) (never executed)

187. 0.000 0.000 ↓ 0.0 0

Hash (cost=27,213.89..27,213.89 rows=662,921 width=11) (never executed)

188. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=6,365.71..27,213.89 rows=662,921 width=11) (never executed)

189. 0.000 0.000 ↓ 0.0 0

HashAggregate (cost=6,365.28..6,394.91 rows=2,963 width=7) (never executed)

  • Group Key: (custom_field_values_9.binded_key)::integer
190. 0.000 0.000 ↓ 0.0 0

Bitmap Heap Scan on custom_field_values custom_field_values_9 (cost=83.53..6,357.83 rows=2,981 width=7) (never executed)

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

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (never executed)

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

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

  • Index Cond: (id = (custom_field_values_9.binded_key)::integer)
  • Heap Fetches: 0
193. 1,139.674 80,675.100 ↑ 517.4 8,534 1,686

Materialize (cost=8,806,695.31..8,989,521.82 rows=4,415,427 width=4) (actual time=47.167..47.850 rows=8,534 loops=1,686)

194. 2.713 79,535.426 ↑ 517.4 8,534 1

Subquery Scan on items_18 (cost=8,806,695.31..8,950,196.69 rows=4,415,427 width=4) (actual time=79,522.128..79,535.426 rows=8,534 loops=1)

195. 4.951 79,532.713 ↑ 517.4 8,534 1

Unique (cost=8,806,695.31..8,906,042.42 rows=4,415,427 width=1,092) (actual time=79,522.125..79,532.713 rows=8,534 loops=1)

196. 13.719 79,527.762 ↑ 517.4 8,534 1

Sort (cost=8,806,695.31..8,817,733.88 rows=4,415,427 width=1,092) (actual time=79,522.123..79,527.762 rows=8,534 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: 2219kB
197. 1.166 79,514.043 ↑ 517.4 8,534 1

Append (cost=178,928.90..1,980,805.95 rows=4,415,427 width=1,092) (actual time=17,847.595..79,514.043 rows=8,534 loops=1)

198. 39,375.380 53,270.986 ↑ 402.9 8,534 1

Hash Semi Join (cost=178,928.90..1,173,706.68 rows=3,438,345 width=205) (actual time=17,847.595..53,270.986 rows=8,534 loops=1)

  • Hash Cond: (items_19.author_id = social_profiles_5.id)
199. 1,338.435 6,794.646 ↓ 1.3 4,530,268 1

Hash Semi Join (cost=3.31..748,656.83 rows=3,439,491 width=205) (actual time=1.558..6,794.646 rows=4,530,268 loops=1)

  • Hash Cond: (items_19.source_id = sources_11.id)
200. 5,455.613 5,455.613 ↓ 1.2 4,530,268 1

Seq Scan on items items_19 (cost=0.00..700,065.99 rows=3,932,645 width=209) (actual time=0.941..5,455.613 rows=4,530,268 loops=1)

  • Filter: (((type)::text = 'Message'::text) AND ((author_type)::text = 'SocialProfile'::text))
  • Rows Removed by Filter: 6341865
201. 0.009 0.598 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=0.598..0.598 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
202. 0.589 0.589 ↑ 1.0 58 1

Seq Scan on sources sources_11 (cost=0.00..2.58 rows=58 width=4) (actual time=0.574..0.589 rows=58 loops=1)

203. 33.595 7,100.960 ↑ 302.8 3,405 1

Hash (cost=162,009.51..162,009.51 rows=1,031,047 width=4) (actual time=7,100.960..7,100.960 rows=3,405 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1037kB
204. 2,883.416 7,067.365 ↑ 302.8 3,405 1

Hash Semi Join (cost=87,045.06..162,009.51 rows=1,031,047 width=4) (actual time=5,706.061..7,067.365 rows=3,405 loops=1)

  • Hash Cond: (social_profiles_5.client_user_id = client_users_21.id)
205. 390.044 390.044 ↑ 1.0 1,539,489 1

Seq Scan on social_profiles social_profiles_5 (cost=0.00..44,187.89 rows=1,539,489 width=8) (actual time=0.578..390.044 rows=1,539,489 loops=1)

206. 22.323 3,793.905 ↑ 194.7 3,405 1

Hash (cost=75,521.55..75,521.55 rows=662,921 width=15) (actual time=3,793.905..3,793.905 rows=3,405 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1034kB
207. 2,350.192 3,771.582 ↑ 194.7 3,405 1

Hash Semi Join (cost=17,973.80..75,521.55 rows=662,921 width=15) (actual time=1,168.083..3,771.582 rows=3,405 loops=1)

  • Hash Cond: (client_users_20.id = client_users_21.id)
208. 282.696 282.696 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_20 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=0.580..282.696 rows=1,325,842 loops=1)

209. 20.906 1,138.694 ↑ 194.7 3,405 1

Hash (cost=6,450.28..6,450.28 rows=662,921 width=11) (actual time=1,138.694..1,138.694 rows=3,405 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1033kB
210. 1.945 1,117.788 ↑ 194.7 3,405 1

Nested Loop (cost=6,357.55..6,450.28 rows=662,921 width=11) (actual time=954.970..1,117.788 rows=3,405 loops=1)

211. 5.106 955.808 ↓ 309.5 3,405 1

HashAggregate (cost=6,357.11..6,357.22 rows=11 width=7) (actual time=954.207..955.808 rows=3,405 loops=1)

  • Group Key: (custom_field_values_10.binded_key)::integer
212. 948.315 950.702 ↓ 309.5 3,405 1

Bitmap Heap Scan on custom_field_values custom_field_values_10 (cost=82.79..6,357.09 rows=11 width=7) (actual time=4.178..950.702 rows=3,405 loops=1)

  • Recheck Cond: (custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value = 'Business TRE'::text))
  • Rows Removed by Filter: 2030
  • Heap Blocks: exact=2010
213. 2.387 2.387 ↓ 1.8 5,435 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=2.387..2.387 rows=5,435 loops=1)

  • Index Cond: (custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid)
214. 160.035 160.035 ↑ 1.0 1 3,405

Index Only Scan using client_users_pkey on client_users client_users_21 (cost=0.43..8.45 rows=1 width=4) (actual time=0.046..0.047 rows=1 loops=3,405)

  • Index Cond: (id = (custom_field_values_10.binded_key)::integer)
  • Heap Fetches: 3405
215. 17,354.757 26,241.891 ↓ 0.0 0 1

Hash Semi Join (cost=123,355.80..762,945.00 rows=977,082 width=205) (actual time=26,241.891..26,241.891 rows=0 loops=1)

  • Hash Cond: (items_20.author_id = client_users_23.id)
216. 462.066 6,738.303 ↓ 1.3 1,277,816 1

Hash Semi Join (cost=36,310.74..603,865.21 rows=977,408 width=205) (actual time=402.499..6,738.303 rows=1,277,816 loops=1)

  • Hash Cond: (items_20.source_id = sources_12.id)
217. 5,880.579 6,274.933 ↓ 1.1 1,277,816 1

Bitmap Heap Scan on items items_20 (cost=36,307.44..590,054.67 rows=1,117,549 width=209) (actual time=401.064..6,274.933 rows=1,277,816 loops=1)

  • Recheck Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
  • Rows Removed by Index Recheck: 5822959
  • Heap Blocks: exact=28045 lossy=343645
218. 394.354 394.354 ↓ 1.1 1,277,816 1

Bitmap Index Scan on index_items_on_type_and_author_type_and_created_at (cost=0.00..36,028.05 rows=1,117,549 width=0) (actual time=394.354..394.354 rows=1,277,816 loops=1)

  • Index Cond: (((type)::text = 'Message'::text) AND ((author_type)::text = 'ClientUser'::text))
219. 0.017 1.304 ↑ 1.0 58 1

Hash (cost=2.58..2.58 rows=58 width=4) (actual time=1.304..1.304 rows=58 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
220. 1.287 1.287 ↑ 1.0 58 1

Seq Scan on sources sources_12 (cost=0.00..2.58 rows=58 width=4) (actual time=1.277..1.287 rows=58 loops=1)

221. 16.684 2,148.831 ↑ 194.7 3,405 1

Hash (cost=75,521.55..75,521.55 rows=662,921 width=15) (actual time=2,148.831..2,148.831 rows=3,405 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1040kB
222. 1,872.568 2,132.147 ↑ 194.7 3,405 1

Hash Semi Join (cost=17,973.80..75,521.55 rows=662,921 width=15) (actual time=65.138..2,132.147 rows=3,405 loops=1)

  • Hash Cond: (client_users_22.id = client_users_23.id)
223. 223.707 223.707 ↑ 1.0 1,325,842 1

Seq Scan on client_users client_users_22 (cost=0.00..33,095.42 rows=1,325,842 width=4) (actual time=1.003..223.707 rows=1,325,842 loops=1)

224. 18.308 35.872 ↑ 194.7 3,405 1

Hash (cost=6,450.28..6,450.28 rows=662,921 width=11) (actual time=35.872..35.872 rows=3,405 loops=1)

  • Buckets: 131072 Batches: 16 Memory Usage: 1033kB
225. 3.133 17.564 ↑ 194.7 3,405 1

Nested Loop (cost=6,357.55..6,450.28 rows=662,921 width=11) (actual time=6.767..17.564 rows=3,405 loops=1)

226. 2.192 7.621 ↓ 309.5 3,405 1

HashAggregate (cost=6,357.11..6,357.22 rows=11 width=7) (actual time=6.750..7.621 rows=3,405 loops=1)

  • Group Key: (custom_field_values_11.binded_key)::integer
227. 4.651 5.429 ↓ 309.5 3,405 1

Bitmap Heap Scan on custom_field_values custom_field_values_11 (cost=82.79..6,357.09 rows=11 width=7) (actual time=1.068..5.429 rows=3,405 loops=1)

  • Recheck Cond: (custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid)
  • Filter: ((deleted_at IS NULL) AND (value = 'Business TRE'::text))
  • Rows Removed by Filter: 2030
  • Heap Blocks: exact=2010
228. 0.778 0.778 ↓ 1.8 5,435 1

Bitmap Index Scan on index_custom_field_values_on_custom_field_id_and_binded_key (cost=0.00..82.78 rows=2,981 width=0) (actual time=0.778..0.778 rows=5,435 loops=1)

  • Index Cond: (custom_field_id = '520d1832-0834-4091-bf56-d56f5d6aa389'::uuid)
229. 6.810 6.810 ↑ 1.0 1 3,405

Index Only Scan using client_users_pkey on client_users client_users_23 (cost=0.43..8.45 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=3,405)

  • Index Cond: (id = (custom_field_values_11.binded_key)::integer)
  • Heap Fetches: 3405
230. 0.000 11.130 ↑ 1.0 1 14

Index Scan using items_pkey on items (cost=3.64..11.53 rows=1 width=8) (actual time=0.794..0.795 rows=1 loops=14)

  • Index Cond: (id = (SubPlan 1))
  • Filter: (source_id = 44)
231.          

SubPlan (for Index Scan)

232. 0.112 14.868 ↑ 1.0 1 14

Limit (cost=0.56..3.21 rows=1 width=12) (actual time=1.060..1.062 rows=1 loops=14)

233. 14.756 14.756 ↑ 12.0 1 14

Index Scan using index_items_on_ticket_id_and_created_at on items items_1 (cost=0.56..32.31 rows=12 width=12) (actual time=1.054..1.054 rows=1 loops=14)

  • Index Cond: (ticket_id = tickets.id)
  • Filter: ((type)::text = 'Message'::text)
234. 1.246 1.624 ↑ 1.0 1 14

Index Only Scan using items_pkey on items last_message (cost=3.64..11.53 rows=1 width=4) (actual time=0.115..0.116 rows=1 loops=14)

  • Index Cond: (id = (SubPlan 2))
  • Heap Fetches: 14
235.          

SubPlan (for Index Only Scan)

236. 0.042 0.378 ↑ 1.0 1 14

Limit (cost=0.56..3.21 rows=1 width=12) (actual time=0.026..0.027 rows=1 loops=14)

237. 0.336 0.336 ↑ 12.0 1 14

Index Scan Backward using index_items_on_ticket_id_and_created_at on items items_2 (cost=0.56..32.31 rows=12 width=12) (actual time=0.024..0.024 rows=1 loops=14)

  • Index Cond: (ticket_id = tickets.id)
  • Filter: ((type)::text = 'Message'::text)
238. 0.025 1.372 ↑ 1.0 1 14

Materialize (cost=0.00..2.73 rows=1 width=4) (actual time=0.095..0.098 rows=1 loops=14)

239. 1.347 1.347 ↑ 1.0 1 1

Seq Scan on sources (cost=0.00..2.73 rows=1 width=4) (actual time=1.312..1.347 rows=1 loops=1)

  • Filter: (id = 44)
  • Rows Removed by Filter: 57
Planning time : 458.417 ms
Execution time : 395,284.887 ms