Skip to content

Instantly share code, notes, and snippets.

@jasonwalkeryung
Last active February 9, 2018 22:30
Show Gist options
  • Save jasonwalkeryung/508ff3d1091872f4b03ef0a3fb1f90b7 to your computer and use it in GitHub Desktop.
Save jasonwalkeryung/508ff3d1091872f4b03ef0a3fb1f90b7 to your computer and use it in GitHub Desktop.
EXPLAIN like '%example'
psql=> explain analyze select distinct users.id, users.name, users.email from users where users.email ilike '%example%';
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Unique (cost=290618.12..290621.50 rows=338 width=71) (actual time=5458.523..5458.560 rows=41 loops=1)
-> Sort (cost=290618.12..290618.97 rows=338 width=71) (actual time=5458.521..5458.539 rows=41 loops=1)
Sort Key: id, name, email
Sort Method: quicksort Memory: 28kB
-> Seq Scan on users (cost=0.00..290603.92 rows=338 width=71) (actual time=97.851..5458.380 rows=41 loops=1)
Filter: ((email)::text ~~* '%example%'::text)
Rows Removed by Filter: 3378716
Planning time: 0.263 ms
Execution time: 5458.595 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment