Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Last active December 20, 2015 11:39
Show Gist options
  • Select an option

  • Save luckyruby/6125324 to your computer and use it in GitHub Desktop.

Select an option

Save luckyruby/6125324 to your computer and use it in GitHub Desktop.
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'lin%') ORDER BY updated_at desc LIMIT 20 OFFSET 0;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------
Limit (cost=159102.95..159103.00 rows=20 width=1053) (actual time=1220.328..1220.336 rows=20 loops=1)
-> Sort (cost=159102.95..159116.11 rows=5263 width=1053) (actual time=1220.326..1220.331 rows=20 loops=1)
Sort Key: updated_at
Sort Method: top-N heapsort Memory: 51kB
-> Seq Scan on reservations (cost=0.00..158962.90 rows=5263 width=1053) (actual time=0.997..1216.519 rows=2266 loops=1)
Filter: (lower((last_name)::text) ~~ 'lin%'::text)
Total runtime: 1220.433 ms
reznet_production=> explain analyze SELECT "reservations".* FROM "reservations" WHERE (lower(last_name) like 'lin%') LIMIT 20 OFFSET 0; QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..604.08 rows=20 width=1053) (actual time=0.988..11.149 rows=20 loops=1)
-> Seq Scan on reservations (cost=0.00..158962.90 rows=5263 width=1053) (actual time=0.987..11.144 rows=20 loops=1)
Filter: (lower((last_name)::text) ~~ 'lin%'::text)
Total runtime: 11.217 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment