Aggregate (cost=139279.85..139279.86 rows=1 width=4) (actual time=502493.000..502493.001 rows=1 loops=1) -> Hash Join (cost=131314.31..139279.84 rows=2 width=4) (actual time=501787.397..502492.316 rows=622 loops=1) Hash Cond: (matview_82034.context_key = articles.context_key) -> Seq Scan on matview_82034 (cost=0.00..6322.20 rows=438220 width=4) (actual time=0.014..462.312 rows=438220 loops=1) -> Hash (cost=131314.30..131314.30 rows=1 width=16) (actual time=501553.755..501553.755 rows=622 loops=1) -> Nested Loop IN Join (cost=46291.79..131314.30 rows=1 width=16) (actual time=467.546..501550.735 rows=622 loops=1) Join Filter: (a.context_key = articles.context_key) -> Nested Loop (cost=46291.79..46323.15 rows=2 width=12) (actual time=179.760..303.474 rows=1473 loops=1) -> Nested Loop (cost=46291.79..46314.35 rows=2 width=8) (actual time=179.743..273.866 rows=1473 loops=1) -> Subquery Scan "IN_subquery" (cost=46291.79..46292.06 rows=5 width=4) (actual time=179.715..233.942 rows=1653 loops=1) -> SetOp Intersect (cost=46291.79..46292.02 rows=5 width=4) (actual time=179.712..229.030 rows=1653 loops=1) -> Sort (cost=46291.79..46291.90 rows=46 width=4) (actual time=179.695..201.068 rows=19529 loops=1) Sort Key: "*SELECT* 1".context_key Sort Method: quicksort Memory: 1684kB -> Append (cost=0.00..46290.52 rows=46 width=4) (actual time=0.065..150.644 rows=19529 loops=1) -> Subquery Scan "*SELECT* 1" (cost=0.00..23145.26 rows=23 width=4) (actual time=0.063..22.643 rows=4003 loops=1) -> Nested Loop (cost=0.00..23145.03 rows=23 width=4) (actual time=0.061..14.740 rows=4003 loops=1) -> Index Scan using words_word on words (cost=0.00..5.47 rows=1 width=4) (actual time=0.037..0.039 rows=1 loops=1) Index Cond: ((word)::text = 'insider'::text) -> Index Scan using article_words_wc on article_words (cost=0.00..22987.86 rows=12136 width=8) (actual time=0.017..6.754 rows=4003 loops=1) Index Cond: (public.article_words.word_key = public.words.word_key) -> Subquery Scan "*SELECT* 2" (cost=0.00..23145.26 rows=23 width=4) (actual time=0.045..88.083 rows=15526 loops=1) -> Nested Loop (cost=0.00..23145.03 rows=23 width=4) (actual time=0.042..56.956 rows=15526 loops=1) -> Index Scan using words_word on words (cost=0.00..5.47 rows=1 width=4) (actual time=0.024..0.027 rows=1 loops=1) Index Cond: ((word)::text = 'trading'::text) -> Index Scan using article_words_wc on article_words (cost=0.00..22987.86 rows=12136 width=8) (actual time=0.013..26.043 rows=15526 loops=1) Index Cond: (public.article_words.word_key = public.words.word_key) -> Index Scan using article_key_idx on articles (cost=0.00..4.44 rows=1 width=4) (actual time=0.016..0.019 rows=1 loops=1653) Index Cond: (articles.context_key = "IN_subquery".context_key) Filter: articles.indexed -> Index Scan using contexts_pkey on contexts (cost=0.00..4.39 rows=1 width=4) (actual time=0.011..0.014 rows=1 loops=1473) Index Cond: (contexts.context_key = articles.context_key) -> Nested Loop (cost=0.00..111660.42 rows=1266104 width=4) (actual time=0.018..300.036 rows=39201 loops=1473) -> Seq Scan on bp_categories (cost=0.00..1315.59 rows=16645 width=4) (actual time=0.008..57.440 rows=14530 loops=1473) Filter: (lower(category) = 'law'::text) -> Index Scan using virtual_ancestor_key_idx on virtual_ancestors a (cost=0.00..5.18 rows=116 width=8) (actual time=0.005..0.009 rows=3 loops=21402942) Index Cond: (a.ancestor_key = bp_categories.context_key) Total runtime: 502493.383 ms