Skip to content

Instantly share code, notes, and snippets.

@gamebusterz
Created September 3, 2018 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gamebusterz/42c6aea5f6466f91782595b7cf06da90 to your computer and use it in GitHub Desktop.
Save gamebusterz/42c6aea5f6466f91782595b7cf06da90 to your computer and use it in GitHub Desktop.
QueryPlan
Aggregate (cost=185894.22..185894.23 rows=1 width=8)
-> Nested Loop (cost=160756.89..185894.21 rows=1 width=0)
Join Filter: ((tableB.module_id = tableCEM.module_id) AND ((uc.c_id)::bpchar = tableCEM.c_id))
-> Hash Join (cost=88782.78..110047.72 rows=1 width=74)
Hash Cond: ((tableA.user_id = tableB.user_id) AND (tableA.module = tableB.module))
-> Seq Scan on tableA (cost=0.00..16237.39 rows=670339 width=16)
-> Hash (cost=88782.76..88782.76 rows=1 width=98)
-> Hash Join (cost=68179.40..88782.76 rows=1 width=98)
Hash Cond: ((tableND.uc_id = uc.uc_id) AND (tableND.ce_id = tableCE.ce_id))
-> Seq Scan on tableND (cost=0.00..15741.92 rows=648192 width=74)
-> Hash (cost=68179.38..68179.38 rows=1 width=357)
-> Hash Join (cost=55332.57..68179.38 rows=1 width=357)
Hash Cond: (((uc.user_id)::bpchar = tableB.user_id) AND (uc.uc_id = uc_progress.uc_id))
-> Seq Scan on uc (cost=0.00..10362.03 rows=331303 width=111)
Filter: current
-> Hash (cost=55332.55..55332.55 rows=1 width=320)
-> Hash Join (cost=35802.36..55332.55 rows=1 width=320)
Hash Cond: (tableB.module = tableCE.module)
-> Seq Scan on tableB (cost=0.00..17016.39 rows=670339 width=90)
-> Hash (cost=35802.35..35802.35 rows=1 width=230)
-> Hash Join (cost=18267.94..35802.35 rows=1 width=230)
Hash Cond: (uc_progress.ce_id = tableCE.ce_id)
-> Seq Scan on uc_progress (cost=0.00..15189.11 rows=625411 width=185)
Filter: current
-> Hash (cost=18193.91..18193.91 rows=5922 width=45)
-> Seq Scan on tableCE (cost=0.00..18193.91 rows=5922 width=45)
Filter: (current AND ((type)::text = 'module'::text))
-> Unique (cost=71974.11..74878.39 rows=38724 width=74)
-> Sort (cost=71974.11..72942.20 rows=387238 width=74)
Sort Key: tableCEM.c_id, tableCEM.module_id
-> Seq Scan on tableCEM (cost=0.00..18823.38 rows=387238 width=74)
Filter: current
Aggregate (cost=196693.62..196693.63 rows=1 width=8)
-> Nested Loop (cost=171556.29..196693.61 rows=1 width=0)
Join Filter: ((tableB.module_id = tableCEM.module_id) AND ((uc.c_id)::bpchar = tableCEM.c_id))
-> Hash Join (cost=99582.18..120847.12 rows=1 width=74)
Hash Cond: ((tableA.user_id = tableB.user_id) AND (tableA.module = tableB.module))
-> Seq Scan on tableA (cost=0.00..16237.39 rows=670339 width=16)
-> Hash (cost=99582.17..99582.17 rows=1 width=98)
-> Hash Join (cost=75862.38..99582.17 rows=1 width=98)
Hash Cond: ((tableB.module = tableCE.module) AND (tableB.user_id = (uc.user_id)::bpchar))
-> Seq Scan on tableB (cost=0.00..17016.39 rows=670339 width=90)
-> Hash (cost=75747.97..75747.97 rows=7627 width=82)
-> Hash Right Join (cost=55861.59..75747.97 rows=7627 width=82)
Hash Cond: ((uc_progress.uc_id = uc.uc_id) AND (uc_progress.ce_id = tableCE.ce_id))
Filter: ((uc_progress.uc_id IS NULL) OR (uc_progress.ce_id IS NULL))
-> Seq Scan on uc_progress (cost=0.00..15194.21 rows=625621 width=185)
Filter: current
-> Hash (cost=55747.19..55747.19 rows=7627 width=156)
-> Hash Join (cost=36612.19..55747.19 rows=7627 width=156)
Hash Cond: (uc.uc_id = tableND.uc_id)
-> Seq Scan on uc (cost=0.00..10362.03 rows=331303 width=111)
Filter: current
-> Hash (cost=36516.85..36516.85 rows=7627 width=82)
-> Hash Join (cost=18267.94..36516.85 rows=7627 width=82)
Hash Cond: (tableND.ce_id = tableCE.ce_id)
-> Seq Scan on tableND (cost=0.00..15741.92 rows=648192 width=74)
-> Hash (cost=18193.91..18193.91 rows=5922 width=45)
-> Seq Scan on tableCE (cost=0.00..18193.91 rows=5922 width=45)
Filter: (current AND ((type)::text = 'module'::text))
-> Unique (cost=71974.11..74878.39 rows=38724 width=74)
-> Sort (cost=71974.11..72942.20 rows=387238 width=74)
Sort Key: tableCEM.c_id, tableCEM.module_id
-> Seq Scan on tableCEM (cost=0.00..18823.38 rows=387238 width=74)
Filter: current
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment