Skip to content

Instantly share code, notes, and snippets.

@ailabs-software
Created September 14, 2019 19:15
Show Gist options
  • Save ailabs-software/0377d7a25659bc469dd04fb24020d86d to your computer and use it in GitHub Desktop.
Save ailabs-software/0377d7a25659bc469dd04fb24020d86d to your computer and use it in GitHub Desktop.
gist
# 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=193082.23..193082.23 rows=1 width=8) (actual time=1616.985..1616.985 rows=0 loops=1)
-> Sort (cost=193082.23..194389.39 rows=522866 width=8) (actual time=1616.984..1616.984 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=90575.50..190467.90 rows=522866 width=8) (actual time=1616.964..1616.964 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..76977.85 rows=562209 width=24) (actual time=0.062..196.015 rows=586599 loops=1)
Index Cond: (status_executed = 0)
-> Hash (cost=68586.25..68586.25 rows=1264945 width=16) (actual time=1156.545..1156.545 rows=1218047 loops=1)
Buckets: 65536 Batches: 4 Memory Usage: 14304kB
-> Seq Scan on publish (cost=0.00..68586.25 rows=1264945 width=16) (actual time=0.016..788.709 rows=1218047 loops=1)
Filter: (funded AND (NOT syndicated))
Rows Removed by Filter: 89160
Total runtime: 1618.072 ms
(14 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment