Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 15, 2019 03:11
Show Gist options
  • Save ailabs-software/441ca478797dfd60b238ab49418fd4db to your computer and use it in GitHub Desktop.
Save ailabs-software/441ca478797dfd60b238ab49418fd4db 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=193666.07..193666.08 rows=1 width=8) (actual time=794.110..794.110 rows=0 loops=1)
Buffers: shared hit=62104, temp read=4116 written=4110
-> Sort (cost=193666.07..194976.67 rows=524239 width=8) (actual time=794.109..794.109 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=62104, temp read=4116 written=4110
-> Hash Join (cost=90818.15..191044.88 rows=524239 width=8) (actual time=794.103..794.103 rows=0 loops=1)
Hash Cond: (publish_queue.publish_id = publish.id)
Buffers: shared hit=62104, temp read=4116 written=4110
-> Index Scan using publish_queue_status_executed_idx on publish_queue (cost=0.43..77252.52 rows=563685 width=24) (actual time=0.033..15.156 rows=28254 loops=1)
Index Cond: (status_executed = 0)
Buffers: shared hit=6972
-> Hash (cost=68769.62..68769.62 rows=1268328 width=16) (actual time=703.105..703.105 rows=1219619 loops=1)
Buckets: 65536 Batches: 4 Memory Usage: 14322kB
Buffers: shared hit=55132, temp written=4020
-> Seq Scan on publish (cost=0.00..68769.62 rows=1268328 width=16) (actual time=0.004..390.459 rows=1219619 loops=1)
Filter: (funded AND (NOT syndicated))
Rows Removed by Filter: 89226
Buffers: shared hit=55132
Total runtime: 794.874 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment