QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=6128.60..6128.71 rows=44 width=696) (actual time=26628.445..26628.477 rows=83 loops=1) CTE x9216478_keyword_xq -> Result (cost=0.00..0.03 rows=1 width=0) (actual time=0.575..0.578 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.164..0.199 rows=1 loops=1) Filter: ((ctype = 'item_lang'::text) AND (code = 'eng'::text)) Rows Removed by Filter: 652 -> Sort (cost=6112.77..6112.88 rows=44 width=696) (actual time=26628.443..26628.456 rows=83 loops=1) Sort Key: ((1.0 / ((avg(COALESCE((ts_rank_cd('{0.1,0.2,0.4,1}'::real[], fe.index_vector, x9216478_keyword_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: 36kB -> HashAggregate (cost=6109.15..6111.57 rows=44 width=696) (actual time=26627.905..26628.287 rows=83 loops=1) -> Nested Loop Left Join (cost=37.56..6074.94 rows=44 width=696) (actual time=26620.992..26625.817 rows=83 loops=1) -> Nested Loop (cost=37.00..6066.68 rows=11 width=681) (actual time=26620.521..26622.003 rows=83 loops=1) Join Filter: (fe.field = fe_weight.id) Rows Removed by Join Filter: 3818 -> Seq Scan on metabib_field fe_weight (cost=0.00..2.47 rows=47 width=8) (actual time=0.007..0.020 rows=47 loops=1) -> Materialize (cost=37.00..6056.48 rows=11 width=681) (actual time=12.251..566.402 rows=83 loops=47) -> Nested Loop (cost=37.00..6056.43 rows=11 width=681) (actual time=575.795..26619.782 rows=83 loops=1) Join Filter: (fe.index_vector @@ x9216478_keyword_xq.tsq) Rows Removed by Join Filter: 1491331 -> Nested Loop (cost=0.00..0.05 rows=1 width=68) (actual time=0.744..0.790 rows=1 loops=1) -> CTE Scan on lang_with (cost=0.00..0.02 rows=1 width=4) (actual time=0.166..0.203 rows=1 loops=1) -> CTE Scan on x9216478_keyword_xq (cost=0.00..0.02 rows=1 width=64) (actual time=0.576..0.583 rows=1 loops=1) -> Nested Loop (cost=37.00..6029.69 rows=2135 width=645) (actual time=356.094..20944.768 rows=1491414 loops=1) -> Nested Loop (cost=36.58..4808.17 rows=1911 width=102) (actual time=356.016..9987.969 rows=1489551 loops=1) -> Bitmap Heap Scan on record_attr_vector_list mrv (cost=36.15..1851.97 rows=1826 width=94) (actual time=355.923..1691.830 rows=1489324 loops=1) Recheck Cond: (vlist @@ '610'::query_int) Rows Removed by Index Recheck: 256867 -> Bitmap Index Scan on mrca_vlist_idx (cost=0.00..35.69 rows=1826 width=0) (actual time=353.980..353.980 rows=1489324 loops=1) Index Cond: (vlist @@ '610'::query_int) -> Index Only Scan using metabib_metarecord_source_map_source_record_idx on metarecord_source_map m (cost=0.43..1.51 rows=11 width=8) (actual time=0.004..0.005 rows=1 loops=1489324) Index Cond: (source = mrv.source) Heap Fetches: 0 -> Index Scan using metabib_keyword_field_entry_source_idx on keyword_field_entry fe (cost=0.43..0.63 rows=1 width=559) (actual time=0.006..0.006 rows=1 loops=1489551) Index Cond: (source = m.source) Filter: (id IS NOT NULL) -> Index Scan using metabib_sorter_s_a_idx on record_sorter pubdate_t (cost=0.56..0.71 rows=4 width=23) (actual time=0.044..0.045 rows=1 loops=83) Index Cond: ((m.source = source) AND (attr = 'pubdate'::text)) Total runtime: 26628.880 ms