QUERY PLAN ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=15477.60..15477.70 rows=40 width=256) (actual time=23519.645..23519.645 rows=1 loops=1) CTE xa741de8_title_xq -> Result (cost=0.00..0.22 rows=1 width=0) (actual time=0.139..0.144 rows=1 loops=1) CTE lang_with -> Seq Scan on coded_value_map (cost=0.00..15.79 rows=1 width=4) (actual time=0.154..0.186 rows=1 loops=1) Filter: ((ctype = 'item_lang'::text) AND (code = 'eng'::text)) Rows Removed by Filter: 652 -> Sort (cost=15461.59..15461.69 rows=40 width=256) (actual time=23519.645..23519.645 rows=1 loops=1) Sort Key: ((1.0 / ((avg(COALESCE((ts_rank_cd('{0.1,0.2,0.4,1}'::real[], fe.index_vector, xa741de8_title_xq.tsq_rank, 14) * (fe_weight.weight)::double precision), 0::double precision)) + ((1 * COALESCE(((NULLIF(first((mrv.vlist @> ARRAY[lang_with.id])), false))::integer * 5), 1)))::double precision))::numeric)), (first(pubdate_t.value)) Sort Method: quicksort Memory: 25kB -> HashAggregate (cost=15458.33..15460.53 rows=40 width=256) (actual time=23519.633..23519.634 rows=1 loops=1) -> Nested Loop Left Join (cost=339.40..15427.23 rows=40 width=256) (actual time=23519.396..23519.409 rows=1 loops=1) -> Nested Loop (cost=338.97..15396.70 rows=40 width=241) (actual time=23519.373..23519.384 rows=1 loops=1) Join Filter: (fe.field = fe_weight.id) Rows Removed by Join Filter: 44 -> Seq Scan on metabib_field fe_weight (cost=0.00..1.45 rows=45 width=8) (actual time=0.005..0.013 rows=45 loops=1) -> Materialize (cost=338.97..15368.35 rows=40 width=241) (actual time=64.597..522.652 rows=1 loops=45) -> Nested Loop (cost=338.97..15368.15 rows=40 width=241) (actual time=2906.824..23519.307 rows=1 loops=1) Join Filter: (fe.index_vector @@ xa741de8_title_xq.tsq) Rows Removed by Join Filter: 2653519 -> Nested Loop (cost=0.00..0.05 rows=1 width=68) (actual time=0.298..0.338 rows=1 loops=1) -> CTE Scan on lang_with (cost=0.00..0.02 rows=1 width=4) (actual time=0.157..0.189 rows=1 loops=1) -> CTE Scan on xa741de8_title_xq (cost=0.00..0.02 rows=1 width=64) (actual time=0.140..0.147 rows=1 loops=1) -> Nested Loop (cost=338.97..15267.17 rows=8074 width=205) (actual time=525.578..21882.048 rows=2653520 loops=1) -> Nested Loop (cost=338.54..13588.80 rows=1914 width=99) (actual time=525.559..9316.296 rows=1677294 loops=1) -> Bitmap Heap Scan on record_attr_vector_list mrv (cost=338.11..6481.07 rows=1821 width=91) (actual time=525.517..1054.394 rows=1587944 loops=1) Recheck Cond: (vlist @@ '( 61 | 311 ) & ( 61 | 311 )'::query_int) -> Bitmap Index Scan on mrca_vlist_idx (cost=0.00..337.66 rows=1821 width=0) (actual time=515.026..515.026 rows=1587948 loops=1) Index Cond: (vlist @@ '( 61 | 311 ) & ( 61 | 311 )'::query_int) -> Index Only Scan using metabib_metarecord_source_map_source_record_idx on metarecord_source_map m (cost=0.43..3.88 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=1587944) Index Cond: (source = mrv.source) Heap Fetches: 1607 -> Index Scan using title_field_entry_source_idx on title_field_entry fe (cost=0.43..0.81 rows=7 width=122) (actual time=0.006..0.006 rows=2 loops=1677294) Index Cond: (source = m.source) Filter: (id IS NOT NULL) -> Index Scan using metabib_sorter_source_idx on record_sorter pubdate_t (cost=0.43..0.75 rows=1 width=23) (actual time=0.020..0.022 rows=1 loops=1) Index Cond: (m.source = source) Filter: (attr = 'pubdate'::text) Rows Removed by Filter: 2 Total runtime: 23519.840 ms (40 rows)