Skip to content

Instantly share code, notes, and snippets.

@macarthy
Last active December 14, 2015 15:48
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 macarthy/5110083 to your computer and use it in GitHub Desktop.
Save macarthy/5110083 to your computer and use it in GitHub Desktop.
slow postgresql query
Column | Type | Modifiers | Storage | Stats target | Description
------------------------+-----------------------------+---------------------------------------------------+----------+--------------+-------------
id | integer | not null default nextval('tags_id_seq'::regclass) | plain | |
type | character varying(255) | | extended | |
label | character varying(255) | | extended | |
created_at | timestamp without time zone | not null | plain | |
updated_at | timestamp without time zone | not null | plain | |
Indexes:
"tags_pkey" PRIMARY KEY, btree (id)
"add_unique_index_label" UNIQUE, btree (label)
"index_tags_on_label" btree (label)
"index_tags_on_type" btree (type)
Has OIDs: no
52118303 rows
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..17534.00 rows=20 width=1585) (actual time=66438.975..83816.000 rows=1 loops=1)
-> Index Scan using add_unique_index_label on tags (cost=0.00..4569360.65 rows=5212 width=1585) (actual time=66438.971..83815.994 rows=1 loops=1)
Filter: ((label)::text ~~* 'rs556'::text)
Rows Removed by Filter: 52118302
Total runtime: 83816.047 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment