Skip to content

Instantly share code, notes, and snippets.

@astro
Created May 20, 2012 01:18
Show Gist options
  • Save astro/2733081 to your computer and use it in GitHub Desktop.
Save astro/2733081 to your computer and use it in GitHub Desktop.
prittorrent=> explain analyze select * from feed_items inner join enclosures on (feed_items.feed=enclosures.feed AND feed_items.id=enclosures.item) inner join enclosure_torrents using (url) order by feed_items.published desc limit 17;
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.00..465.69 rows=17 width=1049) (actual time=0.043..0.597 rows=17 loops=1)
-> Nested Loop (cost=0.00..1807.98 rows=66 width=1049) (actual time=0.043..0.593 rows=17 loops=1)
-> Nested Loop (cost=0.00..1782.72 rows=66 width=1020) (actual time=0.025..0.379 rows=17 loops=1)
-> Index Scan Backward using feed_items_published on feed_items (cost=0.00..1035.62 rows=1560 width=873) (actual time=0.004..0.016 rows=17 loops=1)
-> Index Scan using enclosures_pkey on enclosures (cost=0.00..0.46 rows=1 width=147) (actual time=0.021..0.021 rows=1 loops=17)
Index Cond: ((feed = feed_items.feed) AND (item = feed_items.id))
-> Index Scan using enclosure_torrents_pkey on enclosure_torrents (cost=0.00..0.37 rows=1 width=94) (actual time=0.012..0.012 rows=1 loops=17)
Index Cond: (url = enclosures.url)
Total runtime: 0.627 ms
(9 rows)
prittorrent=> explain analyze select * from feed_items inner join enclosures on (feed_items.feed=enclosures.feed AND feed_items.id=enclosures.item) inner join enclosure_torrents using (url) order by feed_items.published desc limit 18;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=468.65..468.69 rows=18 width=1049) (actual time=22.057..22.059 rows=18 loops=1)
-> Sort (cost=468.65..468.81 rows=66 width=1049) (actual time=22.056..22.057 rows=18 loops=1)
Sort Key: feed_items.published
Sort Method: top-N heapsort Memory: 61kB
-> Nested Loop (cost=74.22..466.94 rows=66 width=1049) (actual time=0.687..20.778 rows=1569 loops=1)
-> Hash Join (cost=74.22..441.69 rows=66 width=1020) (actual time=0.671..2.060 rows=1569 loops=1)
Hash Cond: ((feed_items.feed = enclosures.feed) AND (feed_items.id = enclosures.item))
-> Seq Scan on feed_items (cost=0.00..257.60 rows=1560 width=873) (actual time=0.003..0.312 rows=1560 loops=1)
-> Hash (cost=50.69..50.69 rows=1569 width=147) (actual time=0.662..0.662 rows=1569 loops=1)
Buckets: 1024 Batches: 1 Memory Usage: 277kB
-> Seq Scan on enclosures (cost=0.00..50.69 rows=1569 width=147) (actual time=0.003..0.231 rows=1569 loops=1)
-> Index Scan using enclosure_torrents_pkey on enclosure_torrents (cost=0.00..0.37 rows=1 width=94) (actual time=0.011..0.011 rows=1 loops=1569)
Index Cond: (url = enclosures.url)
Total runtime: 22.099 ms
(14 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment