Skip to content

Instantly share code, notes, and snippets.

@mayel
Last active October 26, 2024 17:57
Show Gist options
  • Save mayel/1e94b3f31040a15848204c149f66a2f8 to your computer and use it in GitHub Desktop.
Save mayel/1e94b3f31040a15848204c149f66a2f8 to your computer and use it in GitHub Desktop.
[debug] query with deferred join: #Ecto.Query<from p0 in Needle.Pointer, as: :main_object,
left_join: a1 in assoc(p0, :activity), as: :activity,
join: f2 in ^#Ecto.Query<from f0 in subquery(from f0 in Bonfire.Data.Social.FeedPublish,
as: :main_object,
join: a1 in Bonfire.Data.Social.Activity,
as: :activity,
on: a1.id == f0.id,
join: p2 in Needle.Pointer,
as: :activity_pointer,
on: p2.id == a1.id and is_nil(p2.deleted_at) and p2.table_id not in ^["6R1VATEMESAGEC0MMVN1CAT10N"],
join: p3 in Needle.Pointer,
as: :object,
on: p3.id == a1.object_id and is_nil(p3.deleted_at) and
(is_nil(p3.table_id) or p3.table_id not in ^["6R1VATEMESAGEC0MMVN1CAT10N"]),
left_join: s4 in assoc(a1, :subject),
as: :subject,
left_join: c5 in assoc(s4, :character),
as: :subject_character,
left_join: p6 in assoc(c5, :peered),
as: :subject_peered,
left_join: p7 in assoc(p3, :peered),
as: :object_peered,
where: a1.verb_id not in ^[
"71AGSPAM0RVNACCEPTAB1E1TEM",
"20SVBSCR1BET0THE0VTPVT0F1T",
"11KES1ND1CATEAM11DAPPR0VA1",
"1P1NN1NNG1S11KEH1GH11GHT1T",
"40NTACTW1THAPR1VATEMESSAGE",
"7PDATETHESTATVS0FS0METH1NG"
],
where: (f0.feed_id == ^"3SERSFR0MY0VR10CA11NSTANCE" or (is_nil(p6.id) and is_nil(p7.id))) and
a1.subject_id != ^"1ACT1V1TYPVBREM0TESFETCHER",
order_by: [desc: a1.id],
distinct: [desc: a1.id],
select: [:id])>,
on: f2.id == p0.id, left_join: s3 in assoc(a1, :subject), as: :subject,
left_join: c4 in assoc(s3, :character), as: :subject_character,
left_join: p5 in assoc(s3, :profile), as: :subject_profile,
left_join: i6 in assoc(p5, :icon), as: :subject_icon,
left_join: o7 in assoc(a1, :object), as: :object,
left_join: c8 in assoc(o7, :created), as: :object_created,
left_join: p9 in Needle.Pointer, as: :object_creator,
on: c8.creator_id != a1.subject_id and c8.creator_id == p9.id,
left_join: c10 in assoc(p9, :character), as: :object_creator_character,
left_join: p11 in assoc(p9, :profile), as: :object_creator_profile,
left_join: i12 in assoc(p11, :icon), as: :object_creator_icon,
left_join: s13 in assoc(a1, :sensitive), as: :sensitive,
left_join: p14 in assoc(o7, :post_content), as: :object_post_content,
left_join: p15 in assoc(o7, :peered), as: :object_peered,
left_join: c16 in assoc(o7, :character), as: :object_character,
left_join: p17 in assoc(o7, :profile), as: :object_profile,
left_join: i18 in assoc(p17, :icon), as: :object_icon,
left_join: r19 in assoc(a1, :replied), as: :replied,
where: is_nil(p0.deleted_at),
where: exists(
subquery(
#Ecto.Query<from p0 in subquery(from p0 in Needle.Pointer,
cross_join: c1 in Bonfire.Data.AccessControl.Controlled,
on: true,
cross_join: v2 in Bonfire.Data.AccessControl.Verb,
on: true,
left_join: g3 in Bonfire.Data.AccessControl.Grant,
on: c1.acl_id == g3.acl_id and g3.verb_id == v2.id,
left_join: c4 in Bonfire.Data.AccessControl.Circle,
on: g3.subject_id == c4.id,
left_join: e5 in Bonfire.Data.AccessControl.Encircle,
on: e5.circle_id == c4.id and e5.subject_id == p0.id,
where: g3.subject_id == p0.id or not is_nil(e5.id),
group_by: [p0.id, c1.id, v2.id],
select: %{subject_id: p0.id, object_id: c1.id, verb_id: v2.id, value: fragment("agg_perms(?)", g3.value)}), where: p0.object_id == parent_as(:activity).object_id, where: p0.subject_id in ^["0AND0MSTRANGERS0FF1NTERNET"] and
p0.verb_id in ^["0BSERV1NG11ST1NGSEX1STENCE", "0EAD1NGSVTTER1YFVNDAMENTA1"], group_by: [p0.object_id], having: fragment("agg_perms(?)", p0.value), select: %{subjects: count(p0.subject_id), object_id: p0.object_id}>
)
),
order_by: [desc: a1.id], select: p0, preload: [activity: [:media]],
preload: [
activity: a1,
activity: {a1, subject: {s3, character: c4, profile: {p5, icon: i6}}},
activity: {a1, object: {o7, created: c8}},
activity: {a1, subject: {s3, character: c4, profile: {p5, icon: i6}}},
activity: {a1, object: {o7, created: c8}},
activity:
{a1, object: {o7, created: {c8, creator: {p9, character: c10, profile: {p11, icon: i12}}}}},
activity:
{a1,
sensitive: s13,
object: {o7, post_content: p14, peered: p15, character: c16, profile: {p17, icon: i18}}},
activity: {a1, sensitive: s13},
activity: {a1, replied: r19},
activity: a1
]> @ Bonfire.Social.FeedActivities.maybe_paginate_and_boundarise_feed_deferred_query/2 @ extensions/bonfire_social/lib/feed_activities.ex:406
[warning] Slow database query: ok db=8710ms repo=Elixir.Bonfire.Common.Repo
EXPLAIN ( ANALYZE TRUE, VERBOSE FALSE, COSTS TRUE, TIMING TRUE, SUMMARY TRUE, FORMAT TEXT ) SELECT p0."id", p0."table_id", p0."deleted_at", b1."id", b1."subject_id", b1."verb_id", b1."object_id", b13."id", b13."is_sensitive", b19."id", b19."reply_to_id", b19."thread_id", b19."direct_replies_count", b19."nested_replies_count", b19."total_replies_count", b19."path", p7."id", p7."table_id", p7."deleted_at", b17."id", b17."name", b17."summary", b17."website", b17."location", b17."icon_id", b17."image_id", b18."id", b18."creator_id", b18."path", b18."file", b18."size", b18."media_type", b18."metadata", b18."deleted_at", b16."id", b16."username", b16."username_hash", b16."outbox_id", b16."inbox_id", b16."notifications_id", b8."id", b8."creator_id", p9."id", p9."table_id", p9."deleted_at", b11."id", b11."name", b11."summary", b11."website", b11."location", b11."icon_id", b11."image_id", b12."id", b12."creator_id", b12."path", b12."file", b12."size", b12."media_type", b12."metadata", b12."deleted_at", b10."id", b10."username", b10."username_hash", b10."outbox_id", b10."inbox_id", b10."notifications_id", b15."id", b15."peer_id", b15."canonical_uri", b14."id", b14."name", b14."summary", b14."html_body", p3."id", p3."table_id", p3."deleted_at", b5."id", b5."name", b5."summary", b5."website", b5."location", b5."icon_id", b5."image_id", b6."id", b6."creator_id", b6."path", b6."file", b6."size", b6."media_type", b6."metadata", b6."deleted_at", b4."id", b4."username", b4."username_hash", b4."outbox_id", b4."inbox_id", b4."notifications_id" FROM "pointers_pointer" AS p0 LEFT OUTER JOIN "bonfire_data_social_activity" AS b1 ON b1."id" = p0."id" INNER JOIN (SELECT DISTINCT ON (sb1."id") sb0."id" AS "id" FROM "bonfire_data_social_feed_publish" AS sb0 INNER JOIN "bonfire_data_social_activity" AS sb1 ON sb1."id" = sb0."id" INNER JOIN "pointers_pointer" AS sp2 ON ((sp2."id" = sb1."id") AND (sp2."deleted_at" IS NULL)) AND NOT (sp2."table_id" = ANY('{6R1VATEMESAGEC0MMVN1CAT10N}')) INNER JOIN "pointers_pointer" AS sp3 ON ((sp3."id" = sb1."object_id") AND (sp3."deleted_at" IS NULL)) AND ((sp3."table_id" IS NULL) OR NOT (sp3."table_id" = ANY('{6R1VATEMESAGEC0MMVN1CAT10N}'))) LEFT OUTER JOIN "pointers_pointer" AS sp4 ON sp4."id" = sb1."subject_id" LEFT OUTER JOIN "bonfire_data_identity_character" AS sb5 ON sb5."id" = sp4."id" LEFT OUTER JOIN "bonfire_data_activity_pub_peered" AS sb6 ON sb6."id" = sb5."id" LEFT OUTER JOIN "bonfire_data_activity_pub_peered" AS sb7 ON sb7."id" = sp3."id" WHERE (NOT (sb1."verb_id" = ANY('{71AGSPAM0RVNACCEPTAB1E1TEM,20SVBSCR1BET0THE0VTPVT0F1T,11KES1ND1CATEAM11DAPPR0VA1,1P1NN1NNG1S11KEH1GH11GHT1T,40NTACTW1THAPR1VATEMESSAGE,7PDATETHESTATVS0FS0METH1NG}'))) AND (((sb0."feed_id" = '3SERSFR0MY0VR10CA11NSTANCE') OR ((sb6."id" IS NULL) AND (sb7."id" IS NULL))) AND (sb1."subject_id" != '1ACT1V1TYPVBREM0TESFETCHER')) ORDER BY sb1."id" DESC) AS s2 ON s2."id" = p0."id" LEFT OUTER JOIN "pointers_pointer" AS p3 ON p3."id" = b1."subject_id" LEFT OUTER JOIN "bonfire_data_identity_character" AS b4 ON b4."id" = p3."id" LEFT OUTER JOIN "bonfire_data_social_profile" AS b5 ON b5."id" = p3."id" LEFT OUTER JOIN "bonfire_files_media" AS b6 ON b6."id" = b5."icon_id" LEFT OUTER JOIN "pointers_pointer" AS p7 ON p7."id" = b1."object_id" LEFT OUTER JOIN "bonfire_data_social_created" AS b8 ON b8."id" = p7."id" LEFT OUTER JOIN "pointers_pointer" AS p9 ON (b8."creator_id" != b1."subject_id") AND (b8."creator_id" = p9."id") LEFT OUTER JOIN "bonfire_data_identity_character" AS b10 ON b10."id" = p9."id" LEFT OUTER JOIN "bonfire_data_social_profile" AS b11 ON b11."id" = p9."id" LEFT OUTER JOIN "bonfire_files_media" AS b12 ON b12."id" = b11."icon_id" LEFT OUTER JOIN "bonfire_data_social_sensitive" AS b13 ON b13."id" = b1."object_id" LEFT OUTER JOIN "bonfire_data_social_post_content" AS b14 ON b14."id" = p7."id" LEFT OUTER JOIN "bonfire_data_activity_pub_peered" AS b15 ON b15."id" = p7."id" LEFT OUTER JOIN "bonfire_data_identity_character" AS b16 ON b16."id" = p7."id" LEFT OUTER JOIN "bonfire_data_social_profile" AS b17 ON b17."id" = p7."id" LEFT OUTER JOIN "bonfire_files_media" AS b18 ON b18."id" = b17."icon_id" LEFT OUTER JOIN "bonfire_data_social_replied" AS b19 ON b19."id" = b1."object_id" WHERE (p0."deleted_at" IS NULL) AND (exists((SELECT count(ss0."subject_id"), ss0."object_id" FROM (SELECT ssp0."id" AS "subject_id", ssb1."id" AS "object_id", ssb2."id" AS "verb_id", agg_perms(ssb3."value") AS "value" FROM "pointers_pointer" AS ssp0 CROSS JOIN "bonfire_data_access_control_controlled" AS ssb1 CROSS JOIN "bonfire_data_access_control_verb" AS ssb2 LEFT OUTER JOIN "bonfire_data_access_control_grant" AS ssb3 ON (ssb1."acl_id" = ssb3."acl_id") AND (ssb3."verb_id" = ssb2."id") LEFT OUTER JOIN "bonfire_data_access_control_circle" AS ssb4 ON ssb3."subject_id" = ssb4."id" LEFT OUTER JOIN "bonfire_data_access_control_encircle" AS ssb5 ON (ssb5."circle_id" = ssb4."id") AND (ssb5."subject_id" = ssp0."id") WHERE ((ssb3."subject_id" = ssp0."id") OR NOT (ssb5."id" IS NULL)) GROUP BY ssp0."id", ssb1."id", ssb2."id") AS ss0 WHERE (ss0."object_id" = b1."object_id") AND (ss0."subject_id" = ANY('{0AND0MSTRANGERS0FF1NTERNET}') AND ss0."verb_id" = ANY('{0BSERV1NG11ST1NGSEX1STENCE,0EAD1NGSVTTER1YFVNDAMENTA1}')) GROUP BY ss0."object_id" HAVING (agg_perms(ss0."value"))))) ORDER BY b1."id" DESC
Sort (cost=118461.40..118511.80 rows=20161 width=3745) (actual time=8648.257..8666.173 rows=42876 loops=1)
Sort Key: b1.id DESC
Sort Method: external merge Disk: 34104kB
-> Hash Left Join (cost=34304.81..51968.96 rows=20161 width=3745) (actual time=8395.462..8584.437 rows=42876 loops=1)
Hash Cond: (b1.object_id = b19.id)
-> Hash Left Join (cost=32541.89..50153.11 rows=20161 width=3629) (actual time=8381.721..8556.884 rows=42876 loops=1)
Hash Cond: (p7.id = b16.id)
-> Hash Left Join (cost=32400.11..49958.41 rows=20161 width=3503) (actual time=8381.348..8548.615 rows=42876 loops=1)
Hash Cond: (p7.id = b15.id)
-> Hash Left Join (cost=32370.31..49875.68 rows=20161 width=3439) (actual time=8381.338..8542.185 rows=42876 loops=1)
Hash Cond: (p7.id = b17.id)
-> Hash Left Join (cost=32216.04..49644.13 rows=20161 width=2484) (actual time=8380.664..8533.643 rows=42876 loops=1)
Hash Cond: (p7.id = b14.id)
-> Hash Left Join (cost=30794.72..48169.88 rows=20161 width=2435) (actual time=8373.913..8515.199 rows=42876 loops=1)
Hash Cond: (b1.object_id = b13.id)
-> Hash Left Join (cost=29619.20..46941.44 rows=20161 width=2418) (actual time=8367.472..8497.371 rows=42876 loops=1)
Hash Cond: (p9.id = b10.id)
-> Hash Left Join (cost=29477.41..46746.73 rows=20161 width=2292) (actual time=8367.116..8491.351 rows=42876 loops=1)
Hash Cond: (p9.id = b11.id)
-> Nested Loop Left Join (cost=29323.14..46515.18 rows=20161 width=1337) (actual time=8366.432..8484.332 rows=42876 loops=1)
Join Filter: (b8.creator_id <> b1.subject_id)
Rows Removed by Join Filter: 42876
-> Hash Left Join (cost=29322.72..33275.59 rows=20161 width=1297) (actual time=8366.415..8437.519 rows=42876 loops=1)
Hash Cond: (p7.id = b8.id)
-> Hash Left Join (cost=28095.65..31995.59 rows=20161 width=1265) (actual time=8359.526..8420.117 rows=42876 loops=1)
Hash Cond: (p3.id = b4.id)
-> Hash Left Join (cost=27953.86..31800.88 rows=20161 width=1139) (actual time=8359.148..8412.750 rows=42876 loops=1)
Hash Cond: (p3.id = b5.id)
-> Nested Loop Left Join (cost=27799.59..31569.33 rows=20161 width=184) (actual time=8356.855..8401.827 rows=42876 loops=1)
-> Hash Right Join (cost=27799.16..30924.21 rows=20161 width=144) (actual time=8356.825..8389.370 rows=42876 loops=1)
Hash Cond: (p7.id = b1.object_id)
-> Seq Scan on pointers_pointer p7 (cost=0.00..2407.59 rows=137559 width=40) (actual time=0.017..6.431 rows=138940 loops=1)
-> Hash (cost=27547.15..27547.15 rows=20161 width=104) (actual time=8356.515..8357.021 rows=42876 loops=1)
Buckets: 65536 (originally 32768) Batches: 1 (originally 1) Memory Usage: 5872kB
-> Hash Join (cost=20564.42..27547.15 rows=20161 width=104) (actual time=8301.565..8348.897 rows=42876 loops=1)
Hash Cond: (s2.id = p0.id)
-> Subquery Scan on s2 (cost=14109.46..19270.37 rows=40321 width=16) (actual time=129.924..161.857 rows=42876 loops=1)
-> Unique (cost=14109.46..18867.16 rows=40321 width=32) (actual time=129.899..159.061 rows=42876 loops=1)
-> Gather Merge (cost=14109.46..18765.04 rows=40849 width=32) (actual time=129.898..149.500 rows=171157 loops=1)
Workers Planned: 1
Workers Launched: 1
-> Sort (cost=13109.45..13169.52 rows=24029 width=32) (actual time=118.885..124.049 rows=85578 loops=2)
Sort Key: sb0.id DESC
Sort Method: external merge Disk: 3560kB
Worker 0: Sort Method: external merge Disk: 3496kB
-> Parallel Hash Join (cost=8015.83..11361.04 rows=24029 width=32) (actual time=72.470..99.832 rows=85578 loops=2)
Hash Cond: (sb0.id = sb1.id)
Join Filter: ((sb0.feed_id = '797632fc-029e-06f0-1031-410d73a5558e'::uuid) OR ((sb6.id IS NULL) AND (sb7.id IS NULL)))
-> Parallel Seq Scan on bonfire_data_social_feed_publish sb0 (cost=0.00..2264.19 rows=99819 width=32) (actual time=0.033..8.482 rows=85582 loops=2)
-> Parallel Hash (cost=7719.38..7719.38 rows=23716 width=64) (actual time=72.276..72.288 rows=21438 loops=2)
Buckets: 65536 Batches: 1 Memory Usage: 3232kB
-> Hash Left Join (cost=4469.17..7719.38 rows=23716 width=64) (actual time=42.284..67.962 rows=21438 loops=2)
Hash Cond: (sp3.id = sb7.id)
-> Hash Left Join (cost=4439.37..7627.33 rows=23716 width=64) (actual time=42.274..65.929 rows=21438 loops=2)
Hash Cond: (sp4.id = sb5.id)
-> Nested Loop Left Join (cost=4264.77..7361.81 rows=23716 width=64) (actual time=40.333..61.170 rows=21438 loops=2)
-> Parallel Hash Join (cost=4264.34..6649.57 rows=23716 width=64) (actual time=40.296..55.431 rows=21438 loops=2)
Hash Cond: (sp3.id = sb1.object_id)
-> Parallel Seq Scan on pointers_pointer sp3 (cost=0.00..1942.32 rows=80912 width=16) (actual time=0.030..5.766 rows=69470 loops=2)
Filter: ((deleted_at IS NULL) AND ((table_id IS NULL) OR (table_id <> ALL ('{d80ed5a7-51d9-541c-c052-9ba858ad0415}'::uuid[]))))
-> Parallel Hash (cost=3967.87..3967.87 rows=23717 width=64) (actual time=40.031..40.035 rows=21438 loops=2)
Buckets: 65536 Batches: 1 Memory Usage: 4576kB
-> Hash Join (cost=1813.15..3967.87 rows=23717 width=64) (actual time=20.613..34.902 rows=21438 loops=2)
Hash Cond: (sp2.id = sb1.id)
-> Parallel Seq Scan on pointers_pointer sp2 (cost=0.00..1942.32 rows=80912 width=16) (actual time=6.598..12.018 rows=69470 loops=2)
Filter: ((deleted_at IS NULL) AND (table_id <> ALL ('{d80ed5a7-51d9-541c-c052-9ba858ad0415}'::uuid[])))
-> Hash (cost=1309.14..1309.14 rows=40321 width=48) (actual time=13.363..13.364 rows=42876 loops=2)
Buckets: 65536 Batches: 1 Memory Usage: 3862kB
-> Seq Scan on bonfire_data_social_activity sb1 (cost=0.00..1309.14 rows=40321 width=48) (actual time=0.027..5.511 rows=42876 loops=2)
Filter: ((subject_id <> '2a6683b0-ebd6-daf0-ea03-4ecbdda645d8'::uuid) AND (verb_id <> ALL ('{e1543365-5018-dd54-c63a-da52c2e0e9d4,40ced796-602b-7681-a8b8-1bd5b7a03c3a,219bb21a-b42c-569c-aa04-2d55ad806d41,360d6a1a-d601-c843-3744-30884308e83a,80ae94cd-703a-8aad-80ed-5a751d9caa0e,f66ab4ed-45d9-d2b5-bc81-f9051da886b0}'::uuid[])))
Rows Removed by Filter: 4
-> Memoize (cost=0.43..0.55 rows=1 width=16) (actual time=0.000..0.000 rows=1 loops=42876)
Cache Key: sb1.subject_id
Cache Mode: logical
Hits: 21470 Misses: 221 Evictions: 0 Overflows: 0 Memory Usage: 28kB
Worker 0: Hits: 20964 Misses: 221 Evictions: 0 Overflows: 0 Memory Usage: 28kB
-> Index Only Scan using pointers_pointer_pkey on pointers_pointer sp4 (cost=0.42..0.54 rows=1 width=16) (actual time=0.002..0.002 rows=1 loops=442)
Index Cond: (id = sb1.subject_id)
Heap Fetches: 0
-> Hash (cost=160.28..160.28 rows=1146 width=32) (actual time=1.924..1.926 rows=1146 loops=2)
Buckets: 2048 Batches: 1 Memory Usage: 70kB
-> Hash Left Join (cost=29.80..160.28 rows=1146 width=32) (actual time=0.020..1.766 rows=1146 loops=2)
Hash Cond: (sb5.id = sb6.id)
-> Seq Scan on bonfire_data_identity_character sb5 (cost=0.00..127.46 rows=1146 width=16) (actual time=0.010..1.631 rows=1146 loops=2)
-> Hash (cost=18.80..18.80 rows=880 width=16) (actual time=0.003..0.004 rows=0 loops=2)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_data_activity_pub_peered sb6 (cost=0.00..18.80 rows=880 width=16) (actual time=0.003..0.003 rows=0 loops=2)
-> Hash (cost=18.80..18.80 rows=880 width=16) (actual time=0.002..0.003 rows=0 loops=2)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_data_activity_pub_peered sb7 (cost=0.00..18.80 rows=880 width=16) (actual time=0.002..0.002 rows=0 loops=2)
-> Hash (cost=4520.21..4520.21 rows=68780 width=104) (actual time=8171.407..8171.418 rows=42880 loops=1)
Buckets: 65536 Batches: 2 Memory Usage: 3162kB
-> Hash Left Join (cost=1410.03..4520.21 rows=68780 width=104) (actual time=85.299..8143.200 rows=42880 loops=1)
Hash Cond: (p0.id = b1.id)
Filter: EXISTS(SubPlan 1)
Rows Removed by Filter: 96060
-> Seq Scan on pointers_pointer p0 (cost=0.00..2407.59 rows=137559 width=40) (actual time=71.811..88.380 rows=138940 loops=1)
Filter: (deleted_at IS NULL)
-> Hash (cost=905.57..905.57 rows=40357 width=64) (actual time=10.871..10.872 rows=42880 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 4532kB
-> Seq Scan on bonfire_data_social_activity b1 (cost=0.00..905.57 rows=40357 width=64) (actual time=0.029..3.305 rows=42880 loops=1)
SubPlan 1
-> GroupAggregate (cost=335.27..341.49 rows=1 width=24) (actual time=0.057..0.057 rows=0 loops=138940)
Filter: agg_perms((agg_perms(ssb3.value)))
-> GroupAggregate (cost=335.27..340.95 rows=2 width=49) (actual time=0.057..0.057 rows=1 loops=138940)
Group Key: ssp0.id, ssb2.id
-> Sort (cost=335.27..335.32 rows=22 width=49) (actual time=0.056..0.057 rows=1 loops=138940)
Sort Key: ssp0.id, ssb2.id
Sort Method: quicksort Memory: 25kB
-> Hash Right Join (cost=228.69..334.78 rows=22 width=49) (actual time=0.055..0.056 rows=1 loops=138940)
Hash Cond: ((ssb5.circle_id = pointers_pointer.id) AND (ssb5.subject_id = ssp0.id))
Filter: ((ssb3.subject_id = ssp0.id) OR (ssb5.id IS NOT NULL))
Rows Removed by Filter: 6
-> Seq Scan on bonfire_data_access_control_encircle ssb5 (cost=0.00..97.47 rows=1147 width=48) (actual time=0.001..0.059 rows=1147 loops=42880)
-> Hash (cost=228.36..228.36 rows=22 width=81) (actual time=0.015..0.015 rows=6 loops=138940)
Buckets: 1024 Batches: 1 Memory Usage: 11kB
-> Nested Loop Left Join (cost=5.85..228.36 rows=22 width=81) (actual time=0.003..0.014 rows=6 loops=138940)
-> Nested Loop (cost=5.43..216.43 rows=22 width=65) (actual time=0.002..0.010 rows=6 loops=138940)
-> Index Only Scan using pointers_pointer_pkey on pointers_pointer ssp0 (cost=0.42..8.44 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=138940)
Index Cond: (id = ANY ('{0aab414c-eb0a-ac1d-8c81-ef0d74ec55da}'::uuid[]))
Heap Fetches: 0
-> Nested Loop Left Join (cost=5.01..207.77 rows=22 width=49) (actual time=0.001..0.009 rows=6 loops=138940)
-> Nested Loop (cost=4.59..18.40 rows=22 width=48) (actual time=0.001..0.002 rows=6 loops=138940)
-> Index Only Scan using bonfire_data_access_control_controlled_pkey on bonfire_data_access_control_controlled ssb1 (cost=0.42..8.61 rows=11 width=32) (actual time=0.001..0.001 rows=3 loops=138940)
Index Cond: (id = b1.object_id)
Heap Fetches: 3230
-> Materialize (cost=4.17..9.52 rows=2 width=16) (actual time=0.000..0.000 rows=2 loops=428939)
-> Bitmap Heap Scan on bonfire_data_access_control_verb ssb2 (cost=4.17..9.51 rows=2 width=16) (actual time=0.011..0.012 rows=2 loops=1)
Recheck Cond: (id = ANY ('{0bcbb1b0-d601-0e74-1ac3-2ee873a7558e,0e534358-677a-d3b0-1f3f-756aa8eae941}'::uuid[]))
Heap Blocks: exact=1
-> Bitmap Index Scan on bonfire_data_access_control_verb_pkey (cost=0.00..4.17 rows=2 width=0) (actual time=0.004..0.004 rows=2 loops=1)
Index Cond: (id = ANY ('{0bcbb1b0-d601-0e74-1ac3-2ee873a7558e,0e534358-677a-d3b0-1f3f-756aa8eae941}'::uuid[]))
-> Index Scan using bonfire_data_access_control_grant_acl_id_subject_id_verb_id_ind on bonfire_data_access_control_grant ssb3 (cost=0.42..8.60 rows=1 width=49) (actual time=0.001..0.001 rows=1 loops=857878)
Index Cond: ((acl_id = ssb1.acl_id) AND (verb_id = ssb2.id))
-> Index Scan using pointers_pointer_pkey on pointers_pointer (cost=0.42..0.54 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=857878)
Index Cond: (id = ssb3.subject_id)
Filter: ((deleted_at IS NULL) AND (table_id = '81c302ec-ab0e-56c3-90ac-210ebd9602ce'::uuid))
Rows Removed by Filter: 0
-> Memoize (cost=0.43..0.65 rows=1 width=40) (actual time=0.000..0.000 rows=1 loops=42876)
Cache Key: b1.subject_id
Cache Mode: logical
Hits: 42655 Misses: 221 Evictions: 0 Overflows: 0 Memory Usage: 32kB
-> Index Scan using pointers_pointer_pkey on pointers_pointer p3 (cost=0.42..0.64 rows=1 width=40) (actual time=0.002..0.002 rows=1 loops=221)
Index Cond: (id = b1.subject_id)
-> Hash (cost=139.94..139.94 rows=1146 width=955) (actual time=2.275..2.277 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 362kB
-> Hash Left Join (cost=12.47..139.94 rows=1146 width=955) (actual time=0.019..1.997 rows=1146 loops=1)
Hash Cond: (b5.icon_id = b6.id)
-> Seq Scan on bonfire_data_social_profile b5 (cost=0.00..124.46 rows=1146 width=299) (actual time=0.005..1.822 rows=1146 loops=1)
-> Hash (cost=11.10..11.10 rows=110 width=656) (actual time=0.006..0.007 rows=0 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_files_media b6 (cost=0.00..11.10 rows=110 width=656) (actual time=0.006..0.006 rows=0 loops=1)
-> Hash (cost=127.46..127.46 rows=1146 width=126) (actual time=0.369..0.369 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 193kB
-> Seq Scan on bonfire_data_identity_character b4 (cost=0.00..127.46 rows=1146 width=126) (actual time=0.004..0.187 rows=1146 loops=1)
-> Hash (cost=737.59..737.59 rows=39159 width=32) (actual time=6.752..6.753 rows=42880 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 3192kB
-> Seq Scan on bonfire_data_social_created b8 (cost=0.00..737.59 rows=39159 width=32) (actual time=0.003..1.958 rows=42880 loops=1)
-> Index Scan using pointers_pointer_pkey on pointers_pointer p9 (cost=0.42..0.64 rows=1 width=40) (actual time=0.001..0.001 rows=1 loops=42876)
Index Cond: (id = b8.creator_id)
-> Hash (cost=139.94..139.94 rows=1146 width=955) (actual time=0.674..0.676 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 362kB
-> Hash Left Join (cost=12.47..139.94 rows=1146 width=955) (actual time=0.014..0.281 rows=1146 loops=1)
Hash Cond: (b11.icon_id = b12.id)
-> Seq Scan on bonfire_data_social_profile b11 (cost=0.00..124.46 rows=1146 width=299) (actual time=0.004..0.117 rows=1146 loops=1)
-> Hash (cost=11.10..11.10 rows=110 width=656) (actual time=0.001..0.002 rows=0 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_files_media b12 (cost=0.00..11.10 rows=110 width=656) (actual time=0.001..0.001 rows=0 loops=1)
-> Hash (cost=127.46..127.46 rows=1146 width=126) (actual time=0.348..0.349 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 193kB
-> Seq Scan on bonfire_data_identity_character b10 (cost=0.00..127.46 rows=1146 width=126) (actual time=0.003..0.105 rows=1146 loops=1)
-> Hash (cost=694.12..694.12 rows=38512 width=17) (actual time=6.223..6.223 rows=42872 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 2564kB
-> Seq Scan on bonfire_data_social_sensitive b13 (cost=0.00..694.12 rows=38512 width=17) (actual time=0.016..1.854 rows=42872 loops=1)
-> Hash (cost=871.70..871.70 rows=43970 width=49) (actual time=6.652..6.652 rows=42872 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 3929kB
-> Seq Scan on bonfire_data_social_post_content b14 (cost=0.00..871.70 rows=43970 width=49) (actual time=0.005..2.122 rows=42872 loops=1)
-> Hash (cost=139.94..139.94 rows=1146 width=955) (actual time=0.664..0.666 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 362kB
-> Hash Left Join (cost=12.47..139.94 rows=1146 width=955) (actual time=0.013..0.294 rows=1146 loops=1)
Hash Cond: (b17.icon_id = b18.id)
-> Seq Scan on bonfire_data_social_profile b17 (cost=0.00..124.46 rows=1146 width=299) (actual time=0.005..0.132 rows=1146 loops=1)
-> Hash (cost=11.10..11.10 rows=110 width=656) (actual time=0.002..0.003 rows=0 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_files_media b18 (cost=0.00..11.10 rows=110 width=656) (actual time=0.002..0.002 rows=0 loops=1)
-> Hash (cost=18.80..18.80 rows=880 width=64) (actual time=0.002..0.003 rows=0 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 8kB
-> Seq Scan on bonfire_data_activity_pub_peered b15 (cost=0.00..18.80 rows=880 width=64) (actual time=0.002..0.002 rows=0 loops=1)
-> Hash (cost=127.46..127.46 rows=1146 width=126) (actual time=0.365..0.365 rows=1146 loops=1)
Buckets: 2048 Batches: 1 Memory Usage: 193kB
-> Seq Scan on bonfire_data_identity_character b16 (cost=0.00..127.46 rows=1146 width=126) (actual time=0.007..0.127 rows=1146 loops=1)
-> Hash (cost=1228.52..1228.52 rows=42752 width=116) (actual time=13.529..13.529 rows=42872 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 6727kB
-> Seq Scan on bonfire_data_social_replied b19 (cost=0.00..1228.52 rows=42752 width=116) (actual time=0.009..4.286 rows=42872 loops=1)
Planning Time: 6.399 ms
JIT:
Functions: 339
Options: Inlining false, Optimization false, Expressions true, Deforming true
Timing: Generation 17.646 ms (Deform 7.814 ms), Inlining 0.000 ms, Optimization 4.246 ms, Emission 81.072 ms, Total 102.964 ms
Execution Time: 8700.840 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment