Re: Queryplan within FTS/GIN index -search. - Mailing list pgsql-performance

From Kevin Grittner
Subject Re: Queryplan within FTS/GIN index -search.
Date
Msg-id 4AE06362020000250002BDFD@gw.wicourts.gov
Whole thread Raw
In response to Queryplan within FTS/GIN index -search.  (Jesper Krogh <jesper@krogh.cc>)
List pgsql-performance
Jesper Krogh <jesper@krogh.cc> wrote:

> I'm searching the gin-index for 1-5 terms, where all of them matches
> the same document. TERM1 is unique by itself, TERM2 is a bit more
> common (52 rows), TERM3 more common, TERM4 close to all and TERM5
> all records.

>                Recheck Cond: (ftsbody_body_fts @@ to_tsquery('TERM1
> & TERM2 & TERM3 & TERM4 & TERM5'::text))
>                ->  Bitmap Index Scan on ftsbody_tfs_idx
> (cost=0.00..100.42 rows=1 width=0) (actual time=1508.998..1508.998
> rows=1 loops=1)
>                      Index Cond: (ftsbody_body_fts @@
> to_tsquery('TERM1 & TERM2 & TERM3 & TERM4 & TERM5'::text))
>  Total runtime: 1509.109 ms

> Can this be optimized? (I cannot really prevent users from typing
> stuff in that are common).

I've wondered that myself.  Perhaps a term which is ANDed with others
and is too common could be dropped from the Index Cond and just left
in the Recheck Cond?

-Kevin

pgsql-performance by date:

Previous
From: Jesper Krogh
Date:
Subject: Queryplan within FTS/GIN index -search.
Next
From: Kevin Buckham
Date:
Subject: Table Clustering & Time Range Queries