A free, self-hostable news aggregator…
Merge branch 'sqlOptimisation' of https://github.com/Alkarex/FreshRSS into Alkarex-sqlOptimisation
Marien Fressinaud94a887f321e7
diff --cc app/models/Category.phpindex 74fccf7a0,2d3a7bde5..ebe55a837--- a/app/models/Category.php+++ b/app/models/Category.php@@@ -175,12 -175,15 +175,15 @@@ class CategoryDAO extends Model_pdo}}- public function listCategories ($prePopulateFeeds = true) { //TODO: Search code-base for places where $prePopulateFeeds should be false+ public function listCategories ($prePopulateFeeds = true) {if ($prePopulateFeeds) {- $sql = 'SELECT c.id as c_id, c.name as c_name, c.color as c_color, count(e.id) as nbNotRead, f.* '+ $sql = 'SELECT c.id AS c_id, c.name AS c_name, c.color AS c_color, '+ . 'COUNT(CASE WHEN e.is_read = 0 THEN 1 END) AS nbNotRead, '+ . 'COUNT(e.id) AS nbEntries, '+ . 'f.* '. 'FROM ' . $this->prefix . 'category c '. 'LEFT OUTER JOIN ' . $this->prefix . 'feed f ON f.category = c.id '- . 'LEFT OUTER JOIN ' . $this->prefix . 'entry e ON e.id_feed = f.id AND e.is_read = 0 '+ . 'LEFT OUTER JOIN ' . $this->prefix . 'entry e ON e.id_feed = f.id '. 'GROUP BY f.id '. 'ORDER BY c.name, f.name';$stm = $this->bd->prepare ($sql);