From 32306a78d2e53bbbc864f3eabda9a2f1a3dd2322 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 16 Nov 2013 21:03:25 +0100 Subject: SQL : grosse mise à jour avec mise en cache du nombre d'articles lus/non-lus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Mise en cache du nombre d'articles lus et non-lus par flux, via `f.cache_nbEntries, f.cache_nbUnreads` pour de biens meilleures performances * Implémente https://github.com/marienfressinaud/FreshRSS/issues/268 * Révision de la plupart des requêtes de modification en conséquence * En cas d'affichage `not_read`, évite de faire une requête si on sait déjà qu'il n'y a pas d'article non lu et fait directement un affichage `all`. * Appelle `cleanOldEntries` seulement une fois de temps en temps aléatoirement (1 fois sur 30 actuellement) pour économiser les ressources, et avant les insertions pour plus de robustesse. * Utilisation des transactions lors de mises à jour multiples et liées * Lors de requêtes de modifications, retourne le nombre de lignes impactées plutôt qu'un booléen en cas de succès * Suppression de code oublié relatif à is_public qui n'est plus utilisé --- public/install.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'public/install.php') diff --git a/public/install.php b/public/install.php index 457605224..47856b6a7 100644 --- a/public/install.php +++ b/public/install.php @@ -15,7 +15,7 @@ define ('SQL_REQ_CAT', 'CREATE TABLE IF NOT EXISTS `%scategory` ( `name` varchar(255) NOT NULL, `color` char(7) NOT NULL, PRIMARY KEY (`id`), - INDEX (`name`) + INDEX (`name`) //v0.7 );'); define ('SQL_REQ_FEED', 'CREATE TABLE IF NOT EXISTS `%sfeed` ( @@ -26,16 +26,18 @@ define ('SQL_REQ_FEED', 'CREATE TABLE IF NOT EXISTS `%sfeed` ( `website` varchar(255) NOT NULL, `description` text NOT NULL, `lastUpdate` int(11) NOT NULL, - `priority` tinyint(2) NOT NULL DEFAULT \'10\', + `priority` tinyint(2) NOT NULL DEFAULT 10, `pathEntries` varchar(511) DEFAULT NULL, `httpAuth` varchar(511) DEFAULT NULL, - `error` boolean NOT NULL DEFAULT \'0\', - `keep_history` boolean NOT NULL DEFAULT \'0\', + `error` boolean NOT NULL DEFAULT 0, + `keep_history` boolean NOT NULL DEFAULT 0, + `cache_nbEntries` int NOT NULL DEFAULT 0, //v0.7 + `cache_nbUnreads` int NOT NULL DEFAULT 0, //v0.7 PRIMARY KEY (`id`), FOREIGN KEY (`category`) REFERENCES %scategory(id) ON DELETE SET NULL ON UPDATE CASCADE, - INDEX (`name`), - INDEX (`priority`), - INDEX (`keep_history`) + INDEX (`name`), //v0.7 + INDEX (`priority`), //v0.7 + INDEX (`keep_history`) //v0.7 );'); define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` ( @@ -46,14 +48,14 @@ define ('SQL_REQ_ENTRY', 'CREATE TABLE IF NOT EXISTS `%sentry` ( `content` text NOT NULL, `link` varchar(1023) NOT NULL, `date` int(11) NOT NULL, - `is_read` boolean NOT NULL DEFAULT \'0\', - `is_favorite` boolean NOT NULL DEFAULT \'0\', + `is_read` boolean NOT NULL DEFAULT 0, + `is_favorite` boolean NOT NULL DEFAULT 0, `id_feed` char(6) NOT NULL, `tags` varchar(1023) NOT NULL, PRIMARY KEY (`id`), FOREIGN KEY (`id_feed`) REFERENCES %sfeed(id) ON DELETE CASCADE ON UPDATE CASCADE, - INDEX (`is_favorite`), - INDEX (`is_read`) + INDEX (`is_favorite`), //v0.7 + INDEX (`is_read`) //v0.7 );'); -- cgit v1.2.3