Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 15, 2019 03:13
Show Gist options
  • Save ailabs-software/5bd19fa70a230a731157f8d2f8b59783 to your computer and use it in GitHub Desktop.
Save ailabs-software/5bd19fa70a230a731157f8d2f8b59783 to your computer and use it in GitHub Desktop.
# EXPLAIN (BUFFERS, ANALYZE)
SELECT maturation_timestamp FROM publish_queue LEFT OUTER JOIN publish ON(publish.id=publish_queue.publish_id)
WHERE status_executed=0 AND funded AND syndicated=false ORDER BY NOT maturation_timestamp IS NULL, maturation_timestamp ASC LIMIT 1;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=54861.93..54861.93 rows=1 width=8) (actual time=60.833..60.833 rows=0 loops=1)
Buffers: shared hit=119987
-> Sort (cost=54861.93..54920.40 rows=23389 width=8) (actual time=60.833..60.833 rows=0 loops=1)
Sort Key: ((publish_queue.maturation_timestamp IS NOT NULL)), publish_queue.maturation_timestamp
Sort Method: quicksort Memory: 25kB
Buffers: shared hit=119987
-> Nested Loop (cost=0.86..54744.99 rows=23389 width=8) (actual time=60.826..60.826 rows=0 loops=1)
Buffers: shared hit=119987
-> Index Scan using publish_queue_status_executed_idx on publish_queue (cost=0.43..14384.12 rows=25149 width=24) (actual time=0.011..13.253 rows=28254 loops=1)
Index Cond: (status_executed = 0)
Buffers: shared hit=6971
-> Index Scan using publish_id_idx on publish (cost=0.43..1.59 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=28254)
Index Cond: (id = publish_queue.publish_id)
Filter: (funded AND (NOT syndicated))
Rows Removed by Filter: 1
Buffers: shared hit=113016
Total runtime: 60.865 ms
(17 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment