Skip to content

Instantly share code, notes, and snippets.

@mdoering
Created January 24, 2017 12:52
Show Gist options
  • Save mdoering/75e2215ebcd3e9ad5f98523fe4651936 to your computer and use it in GitHub Desktop.
Save mdoering/75e2215ebcd3e9ad5f98523fe4651936 to your computer and use it in GitHub Desktop.
explain download
prod_b_registry=# explain analyze SELECT download_key,dataset_key,dataset_title,dataset_doi,dataset_citation,number_records,
prod_b_registry-# key,doi,license,filter,status,download_link,size,total_records,notification_addresses,created_by,send_notification,format,created
prod_b_registry-# FROM dataset_occurrence_download JOIN occurrence_download ON download_key = key
prod_b_registry-# WHERE dataset_key = 'f5de707d-eba1-4f1a-b1df-1a7fa27b1bc7'
prod_b_registry-# ORDER BY created DESC, key
prod_b_registry-# LIMIT 10 OFFSET 27990;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=153436.95..153436.97 rows=10 width=625) (actual time=25626.880..25626.885 rows=10 loops=1)
-> Sort (cost=153366.97..153451.25 rows=33711 width=625) (actual time=25618.442..25624.832 rows=28000 loops=1)
Sort Key: occurrence_download.created, dataset_occurrence_download.download_key
Sort Method: quicksort Memory: 21809kB
-> Hash Join (cost=36106.33..150831.75 rows=33711 width=625) (actual time=1630.837..25536.574 rows=29309 loops=1)
Hash Cond: ((dataset_occurrence_download.download_key)::text = (occurrence_download.key)::text)
-> Bitmap Heap Scan on dataset_occurrence_download (cost=905.82..114999.16 rows=33711 width=272) (actual time=1115.295..24913.904 rows=29309 loops=1)
Recheck Cond: (dataset_key = 'f5de707d-eba1-4f1a-b1df-1a7fa27b1bc7'::uuid)
-> Bitmap Index Scan on dataset_occurrence_download_dataset_key_idx (cost=0.00..897.39 rows=33711 width=0) (actual time=1108.646..1108.646 rows=29309 loops=1)
Index Cond: (dataset_key = 'f5de707d-eba1-4f1a-b1df-1a7fa27b1bc7'::uuid)
-> Hash (cost=31054.67..31054.67 rows=331667 width=353) (actual time=515.219..515.219 rows=332927 loops=1)
Buckets: 65536 Batches: 1 Memory Usage: 128041kB
-> Seq Scan on occurrence_download (cost=0.00..31054.67 rows=331667 width=353) (actual time=0.021..262.715 rows=332927 loops=1)
Total runtime: 25635.317 ms
(14 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment