Skip to content

Instantly share code, notes, and snippets.

Created February 5, 2016 18:10
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 anonymous/6d791da40fe25e096d89 to your computer and use it in GitHub Desktop.
Save anonymous/6d791da40fe25e096d89 to your computer and use it in GitHub Desktop.
test=# explain analyze select id from minion_jobs where state = 'inactive' and delayed < now() and task = any ('{foo,bar,baz,yada}') and queue = 'default' order by priority desc, created limit 1;
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.29..0.69 rows=1 width=20) (actual time=4.076..4.077 rows=1 loops=1)
-> Index Scan using minion_jobs_priority_created_idx on minion_jobs (cost=0.29..817.47 rows=2000 width=20) (actual time=4.074..4.074 rows=1 loops=1)
Filter: ((state = 'inactive'::minion_state) AND (queue = 'default'::text) AND (delayed < now()) AND (task = ANY ('{foo,bar,baz,yada}'::text[])))
Rows Removed by Filter: 8000
Planning time: 1.447 ms
Execution time: 4.149 ms
(6 rows)
(END)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment