Skip to content

Instantly share code, notes, and snippets.

@alekseyl
Last active November 23, 2017 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alekseyl/37ed330c2c952ac3fd00ab092004411b to your computer and use it in GitHub Desktop.
Save alekseyl/37ed330c2c952ac3fd00ab092004411b to your computer and use it in GitHub Desktop.
Fixed plan.
EXPLAIN ANALYZE SELECT id, title FROM "cards"
WHERE (title_tsv @@ to_tsquery( 'english', '(o:*|o)')) AND collection_id = 624::bigint
LIMIT 10;
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=64.38..103.76 rows=10 width=57) (actual time=70.233..70.250 rows=10 loops=1)
-> Bitmap Heap Scan on cards (cost=64.38..210.07 rows=37 width=57) (actual time=70.231..70.248 rows=10 loops=1)
Recheck Cond: ((title_tsv @@ '''o'':* | ''o'''::tsquery) AND (collection_id = '624'::bigint))
Heap Blocks: exact=10
-> Bitmap Index Scan on index_examples_fts_with_collection (cost=0.00..64.37 rows=37 width=0) (actual time=70.204..70.204 rows=131 loops=1)
Index Cond: ((title_tsv @@ '''o'':* | ''o'''::tsquery) AND (collection_id = '624'::bigint))
Planning time: 3.013 ms
Execution time: 70.718 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment