Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE INDEX datasets_notes_trgm_idx ON datasets USING GIN(notes gin_trgm_ops);
- SELECT * FROM datasets
- WHERE
- datasets.notes ILIKE '%test%' OR
- datasets_id IN (SELECT 1)
- "Seq Scan on datasets (cost=0.01..21156.99 rows=53076 width=1428)
- (actual time=0.042..155.697 rows=1098 loops=1)"
- " Filter: ((notes ~~* '%test%'::text) OR (hashed SubPlan 1))"
- " Rows Removed by Filter: 104967"
- " Buffers: shared hit=19634"
- " SubPlan 1"
- " -> Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=1)"
- "Planning time: 0.980 ms"
- "Execution time: 158.579 ms"
- SELECT * FROM datasets
- WHERE
- datasets.notes ILIKE '%test%'
- "Bitmap Heap Scan on datasets (cost=28.68..360.36 rows=87 width=1428)
- (actual time=1.056..11.763 rows=1097 loops=1)"
- " Recheck Cond: (notes ~~* '%test%'::text)"
- " Rows Removed by Index Recheck: 16"
- " Heap Blocks: exact=1053"
- " Buffers: shared hit=1097"
- " -> Bitmap Index Scan on datasets_notes_trgm_idx (cost=0.00..28.66 rows=87 width=0) (actual time=0.732..0.732 rows=1113 loops=1)"
- " Index Cond: (notes ~~* '%test%'::text)"
- " Buffers: shared hit=12"
- "Planning time: 0.869 ms"
- "Execution time: 14.563 ms"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement