From e957c97c947427093d03de3302f4d98909d1ab1a Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 27 Jan 2013 15:35:42 -0500 Subject: Add a key on relative_path_cache in the items table to improve performance on installs that use File_Proxy heavily. Fixes #1920. --- installer/install.sql | 5 +++-- modules/gallery/helpers/gallery_installer.php | 11 +++++++++-- modules/gallery/module.info | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/installer/install.sql b/installer/install.sql index 70cf0c86..4097d51e 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -186,7 +186,8 @@ CREATE TABLE {items} ( KEY `type` (`type`), KEY `random` (`rand_key`), KEY `weight` (`weight`), - KEY `left_ptr` (`left_ptr`) + KEY `left_ptr` (`left_ptr`), + KEY `relative_path_cache` (`relative_path_cache`) ) AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {items} VALUES (1,NULL,NULL,UNIX_TIMESTAMP(),'',NULL,1,1,NULL,NULL,2,0,NULL,'','',1,NULL,NULL,2,NULL,'weight','ASC',1,NULL,NULL,'Gallery','album',UNIX_TIMESTAMP(),0,1,NULL,'1','1'); @@ -244,7 +245,7 @@ CREATE TABLE {modules} ( KEY `weight` (`weight`) ) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',54,1); +INSERT INTO {modules} VALUES (1,1,'gallery',55,1); INSERT INTO {modules} VALUES (2,1,'user',4,2); INSERT INTO {modules} VALUES (3,1,'comment',7,3); INSERT INTO {modules} VALUES (4,1,'organize',4,4); diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 86ff7ce5..d4c4de14 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -116,7 +116,8 @@ class gallery_installer { KEY `type` (`type`), KEY `random` (`rand_key`), KEY `weight` (`weight` DESC), - KEY `left_ptr` (`left_ptr`)) + KEY `left_ptr` (`left_ptr`), + KEY `relative_path_cache` (`relative_path_cache`)) DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE {logs} ( @@ -315,7 +316,7 @@ class gallery_installer { module::set_var("gallery", "lock_timeout", 1); module::set_var("gallery", "movie_extract_frame_time", 3); - module::set_version("gallery", 54); + module::set_version("gallery", 55); } static function upgrade($version) { @@ -784,6 +785,12 @@ class gallery_installer { } module::set_version("gallery", $version = 54); } + + if ($version == 54) { + $db->query("ALTER TABLE {items} ADD KEY `relative_path_cache` (`relative_path_cache`)"); + module::set_version("gallery", $version = 55); + } + } static function uninstall() { diff --git a/modules/gallery/module.info b/modules/gallery/module.info index b6cefe39..d79a5077 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,6 +1,6 @@ name = "Gallery 3" description = "Gallery core application" -version = 54 +version = 55 author_name = "Gallery Team" author_url = "http://codex.galleryproject.org/Gallery:Team" info_url = "http://codex.galleryproject.org/Gallery3:Modules:gallery" -- cgit v1.2.3