Skip to content

Instantly share code, notes, and snippets.

@alekseyl
Created November 24, 2017 13:35
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/ec85c03de2f0a2a60bd1ceb36bc0bcbc to your computer and use it in GitHub Desktop.
Save alekseyl/ec85c03de2f0a2a60bd1ceb36bc0bcbc to your computer and use it in GitHub Desktop.
EXPLAIN ANALYZE SELECT * FROM words WHERE word LIKE 'o%' ORDER BY word USING < LIMIT 10;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=20178.09..20178.12 rows=10 width=440) (actual time=45.203..45.215 rows=10 loops=1)
-> Sort (cost=20178.09..20199.27 rows=8471 width=440) (actual time=45.202..45.203 rows=10 loops=1)
Sort Key: word
Sort Method: top-N heapsort Memory: 29kB
-> Bitmap Heap Scan on words (cost=218.41..19995.04 rows=8471 width=440) (actual time=4.769..26.591 rows=11599 loops=1)
Filter: ((word)::text ~~ 'o%'::text)
Heap Blocks: exact=1192
-> Bitmap Index Scan on index_words_word (cost=0.00..216.29 rows=8387 width=0) (actual time=4.486..4.486 rows=11599 loops=1)
Index Cond: (((word)::text ~>=~ 'o'::text) AND ((word)::text ~<~ 'p'::text))
Planning time: 0.563 ms
Execution time: 45.315 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment