Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. CREATE INDEX datasets_notes_trgm_idx ON datasets USING GIN(notes gin_trgm_ops);
  2.  
  3. SELECT * FROM datasets
  4. WHERE
  5. datasets.notes ILIKE '%test%' OR
  6. datasets_id IN (SELECT 1)
  7.  
  8. "Seq Scan on datasets (cost=0.01..21156.99 rows=53076 width=1428)
  9. (actual time=0.042..155.697 rows=1098 loops=1)"
  10. " Filter: ((notes ~~* '%test%'::text) OR (hashed SubPlan 1))"
  11. " Rows Removed by Filter: 104967"
  12. " Buffers: shared hit=19634"
  13. " SubPlan 1"
  14. " -> Result (cost=0.00..0.01 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=1)"
  15. "Planning time: 0.980 ms"
  16. "Execution time: 158.579 ms"
  17.  
  18. SELECT * FROM datasets
  19. WHERE
  20. datasets.notes ILIKE '%test%'
  21.  
  22. "Bitmap Heap Scan on datasets (cost=28.68..360.36 rows=87 width=1428)
  23. (actual time=1.056..11.763 rows=1097 loops=1)"
  24. " Recheck Cond: (notes ~~* '%test%'::text)"
  25. " Rows Removed by Index Recheck: 16"
  26. " Heap Blocks: exact=1053"
  27. " Buffers: shared hit=1097"
  28. " -> 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)"
  29. " Index Cond: (notes ~~* '%test%'::text)"
  30. " Buffers: shared hit=12"
  31. "Planning time: 0.869 ms"
  32. "Execution time: 14.563 ms"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement