Nested Loop (cost=180190.54..180221.68 rows=2 width=4) (actual time=7300.081..7317.508 rows=622 loops=1) -> Nested Loop (cost=180190.54..180212.88 rows=2 width=20) (actual time=7300.061..7309.989 rows=622 loops=1) -> HashAggregate (cost=180190.54..180190.59 rows=5 width=16) (actual time=7300.017..7300.959 rows=726 loops=1) -> Hash IN Join (cost=167273.49..180190.53 rows=5 width=16) (actual time=6584.948..7298.849 rows=726 loops=1) Hash Cond: (public.contexts.context_key = a.context_key) -> Hash Join (cost=46810.38..54775.93 rows=2 width=12) (actual time=246.691..1176.241 rows=1635 loops=1) Hash Cond: (matview_82034.context_key = public.contexts.context_key) -> Seq Scan on matview_82034 (cost=0.00..6322.20 rows=438220 width=4) (actual time=0.015..448.607 rows=438220 loops=1) -> Hash (cost=46810.32..46810.32 rows=5 width=8) (actual time=244.912..244.912 rows=1653 loops=1) -> Nested Loop (cost=46788.03..46810.32 rows=5 width=8) (actual time=177.216..242.771 rows=1653 loops=1) -> Subquery Scan "IN_subquery" (cost=46788.03..46788.31 rows=5 width=4) (actual time=177.189..223.965 rows=1653 loops=1) -> SetOp Intersect (cost=46788.03..46788.26 rows=5 width=4) (actual time=177.185..220.717 rows=1653 loops=1) -> Sort (cost=46788.03..46788.15 rows=46 width=4) (actual time=177.167..196.638 rows=19530 loops=1) Sort Key: "*SELECT* 1".context_key Sort Method: quicksort Memory: 1684kB -> Append (cost=0.00..46786.76 rows=46 width=4) (actual time=0.070..148.234 rows=19530 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..23393.38 rows=23 width=4) (actual time=0.068..23.265 rows= 4003 loops=1) -> Nested Loop (cost=0.00..23393.15 rows=23 width=4) (actual time=0.066..15.061 rows=4003 loop s=1) -> Index Scan using words_word on words (cost=0.00..5.47 rows=1 width=4) (actual time=0. 040..0.043 rows=1 loops=1) Index Cond: ((word)::text = 'insider'::text) -> Index Scan using article_words_wc on article_words (cost=0.00..23234.38 rows=12264 wi dth=8) (actual time=0.019..7.065 rows=4003 loops=1) Index Cond: (public.article_words.word_key = public.words.word_key) -> Subquery Scan "*SELECT* 2" (cost=0.00..23393.38 rows=23 width=4) (actual time=0.059..87.614 rows= 15527 loops=1) -> Nested Loop (cost=0.00..23393.15 rows=23 width=4) (actual time=0.055..56.982 rows=15527 loo ps=1) -> Index Scan using words_word on words (cost=0.00..5.47 rows=1 width=4) (actual time=0. 032..0.036 rows=1 loops=1) Index Cond: ((word)::text = 'trading'::text) -> Index Scan using article_words_wc on article_words (cost=0.00..23234.38 rows=12264 wi dth=8) (actual time=0.016..26.146 rows=15527 loops=1) Index Cond: (public.article_words.word_key = public.words.word_key) -> Index Scan using contexts_pkey on contexts (cost=0.00..4.39 rows=1 width=4) (actual time=0.006..0.007 rows=1 loops=1653) Index Cond: (public.contexts.context_key = "IN_subquery".context_key) -> Hash (cost=99680.28..99680.28 rows=1266706 width=4) (actual time=6107.125..6107.125 rows=48701 loops=1) -> Merge Join (cost=17126.27..99680.28 rows=1266706 width=4) (actual time=1130.265..6041.874 rows=48701 loops=1) Merge Cond: (bp_categories.context_key = a.ancestor_key) -> Index Scan using bp_categories_context_key_idx on bp_categories (cost=0.00..2543.46 rows=16625 width=4) (actual time=0.027..102 .464 rows=16670 loops=1) Filter: (lower(category) = 'law'::text) -> Index Scan using virtual_ancestor_key_idx on virtual_ancestors a (cost=0.00..79159.65 rows=2297502 width=8) (actual time=0.105. .3400.891 rows=2286890 loops=1) -> Index Scan using article_key_idx on articles (cost=0.00..4.44 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=726) Index Cond: (articles.context_key = public.contexts.context_key) Filter: articles.indexed -> Index Scan using contexts_pkey on contexts (cost=0.00..4.39 rows=1 width=4) (actual time=0.007..0.008 rows=1 loops=622) Index Cond: (public.contexts.context_key = articles.context_key) Total runtime: 7318.618 ms