Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 15, 2019 03:08
Show Gist options
  • Save ailabs-software/055a52987d06a38603ebd891a44c52f0 to your computer and use it in GitHub Desktop.
Save ailabs-software/055a52987d06a38603ebd891a44c52f0 to your computer and use it in GitHub Desktop.
# EXPLAIN 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=193660.99..193660.99 rows=1 width=8) (actual time=668.434..668.434 rows=0 loops=1)
-> Sort (cost=193660.99..194971.58 rows=524239 width=8) (actual time=668.433..668.433 rows=0 loops=1)
Sort Key: ((publish_queue.maturation_timestamp IS NOT NULL)), publish_queue.maturation_timestamp
Sort Method: quicksort Memory: 25kB
-> Hash Join (cost=90814.07..191039.79 rows=524239 width=8) (actual time=668.427..668.427 rows=0 loops=1)
Hash Cond: (publish_queue.publish_id = publish.id)
-> Index Scan using publish_queue_status_executed_idx on publish_queue (cost=0.43..77252.52 rows=563685 width=24) (actual time=0.011..14.442 rows=28254 loops=1)
Index Cond: (status_executed = 0)
-> Hash (cost=68767.12..68767.12 rows=1268281 width=16) (actual time=577.870..577.870 rows=1219614 loops=1)
Buckets: 65536 Batches: 4 Memory Usage: 14322kB
-> Seq Scan on publish (cost=0.00..68767.12 rows=1268281 width=16) (actual time=0.003..355.067 rows=1219614 loops=1)
Filter: (funded AND (NOT syndicated))
Rows Removed by Filter: 89226
Total runtime: 669.475 ms
(14 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment