rendered paste bodyttrssdb=# EXPLAIN ANALYZE SELECT ttrss_feeds.*, SUBSTRING(last_updated,1,19) AS last_updated_noms,(SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries WHERE feed_id = ttrss_feeds.id AND ttrss_user_entries.ref_id = ttrss_entries.id AND owner_uid = '1') AS total, (SELECT COUNT(id) FROM ttrss_entries,ttrss_user_entries WHERE feed_id = ttrss_feeds.id AND unread = true AND ttrss_user_entries.ref_id = ttrss_entries.id AND owner_uid = '1') as unread,cat_id,last_error,ttrss_feed_categories.title AS category,ttrss_feed_categories.collapsed FROM ttrss_feeds LEFT JOIN ttrss_feed_categories ON (ttrss_feed_categories.id = cat_id)WHERE ttrss_feeds.hidden = false AND ttrss_feeds.owner_uid = '1' AND parent_feed IS NULL ORDER BY category,title;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sort (cost=231030.79..231031.44 rows=259 width=604) (actual time=1336.037..1337.241 rows=259 loops=1)
Sort Key: ttrss_feed_categories.title, ttrss_feeds.title
-> Hash Left Join (cost=12.12..231020.41 rows=259 width=604) (actual time=3.568..1329.813 rows=259 loops=1)
Hash Cond: ("outer".cat_id = "inner".id)
-> Seq Scan on ttrss_feeds (cost=0.00..62.24 rows=259 width=185) (actual time=0.018..5.950 rows=259 loops=1)
Filter: ((NOT hidden) AND (owner_uid = 1) AND (parent_feed IS NULL))
-> Hash (cost=11.70..11.70 rows=170 width=423) (actual time=0.128..0.128 rows=2 loops=1)
-> Seq Scan on ttrss_feed_categories (cost=0.00..11.70 rows=170 width=423) (actual time=0.090..0.101 rows=2 loops=1)
SubPlan
-> Aggregate (cost=213.79..213.80 rows=1 width=4) (actual time=0.229..0.234 rows=1 loops=259)
-> Nested Loop (cost=2.27..213.78 rows=1 width=4) (actual time=0.217..0.217 rows=0 loops=259)
-> Bitmap Heap Scan on ttrss_user_entries (cost=2.27..207.76 rows=1 width=4) (actual time=0.192..0.192 rows=0 loops=259)
Recheck Cond: (feed_id = $0)
Filter: (unread AND (owner_uid = 1))
-> Bitmap Index Scan on ttrss_user_entries_feed_id_index (cost=0.00..2.27 rows=78 width=0) (actual time=0.045..0.045 rows=71 loops=259)
Index Cond: (feed_id = $0)
-> Index Scan using ttrss_entries_pkey on ttrss_entries (cost=0.00..6.01 rows=1 width=4) (never executed)
Index Cond: ("outer".ref_id = ttrss_entries.id)
-> Aggregate (cost=677.81..677.82 rows=1 width=4) (actual time=4.801..4.806 rows=1 loops=259)
-> Nested Loop (cost=2.27..677.62 rows=78 width=4) (actual time=0.136..4.410 rows=70 loops=259)
-> Bitmap Heap Scan on ttrss_user_entries (cost=2.27..207.76 rows=78 width=4) (actual time=0.078..0.683 rows=70 loops=259)
Recheck Cond: (feed_id = $0)
Filter: (owner_uid = 1)
-> Bitmap Index Scan on ttrss_user_entries_feed_id_index (cost=0.00..2.27 rows=78 width=0) (actual time=0.056..0.056 rows=71 loops=259)
Index Cond: (feed_id = $0)
-> Index Scan using ttrss_entries_pkey on ttrss_entries (cost=0.00..6.01 rows=1 width=4) (actual time=0.024..0.030 rows=1 loops=18136)
Index Cond: ("outer".ref_id = ttrss_entries.id)
Total runtime: 1338.718 ms
(28 rows)