Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 15, 2019 03:20
Show Gist options
  • Save ailabs-software/a0f81fa6ae2df309c3264ba7c12d0751 to your computer and use it in GitHub Desktop.
Save ailabs-software/a0f81fa6ae2df309c3264ba7c12d0751 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=true ORDER BY NOT maturation_timestamp IS NULL, maturation_timestamp ASC LIMIT 1;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=46708.53..46708.54 rows=1 width=8) (actual time=89.679..89.680 rows=1 loops=1)
Buffers: shared hit=40267
-> Sort (cost=46708.53..46713.43 rows=1958 width=8) (actual time=89.679..89.679 rows=1 loops=1)
Sort Key: ((publish_queue.maturation_timestamp IS NOT NULL)), publish_queue.maturation_timestamp
Sort Method: top-N heapsort Memory: 25kB
Buffers: shared hit=40267
-> Hash Join (cost=28931.63..46698.74 rows=1958 width=8) (actual time=72.490..89.439 rows=1298 loops=1)
Hash Cond: (publish_queue.publish_id = publish.id)
Buffers: shared hit=40267
-> Index Scan using publish_queue_status_executed_idx on publish_queue (cost=0.43..17485.44 rows=30004 width=24) (actual time=0.011..13.300 rows=28253 loops=1)
Index Cond: (status_executed = 0)
Buffers: shared hit=6970
-> Hash (cost=27864.43..27864.43 rows=85341 width=16) (actual time=72.393..72.393 rows=81672 loops=1)
Buckets: 16384 Batches: 1 Memory Usage: 3829kB
Buffers: shared hit=33297
-> Index Scan using publish_funded_syndicated_idx on publish (cost=0.43..27864.43 rows=85341 width=16) (actual time=0.013..58.569 rows=81672 loops=1)
Index Cond: ((funded = true) AND (syndicated = true))
Filter: (funded AND syndicated)
Buffers: shared hit=33297
Total runtime: 89.714 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment