From 977d0da9f3bac811793bffa7cf6b605599c9f871 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 11 May 2009 03:53:44 +0000 Subject: Refactor the exif module to denormalize the stored data. This way we have a single exif_record for each item instead of 1 per key. It's about 5x faster to scan photos this way. --- modules/exif/helpers/exif_installer.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'modules/exif/helpers/exif_installer.php') diff --git a/modules/exif/helpers/exif_installer.php b/modules/exif/helpers/exif_installer.php index 4cd1a6b2..b68af794 100644 --- a/modules/exif/helpers/exif_installer.php +++ b/modules/exif/helpers/exif_installer.php @@ -23,16 +23,11 @@ class exif_installer { if ($version == 0) { $db = Database::instance(); - $db->query("CREATE TABLE IF NOT EXISTS {exif_keys} ( - `id` int(9) NOT NULL auto_increment, - `item_id` int(9) NOT NULL, - `name` varchar(64) NOT NULL, - `value` varchar(1536) NOT NULL, - PRIMARY KEY (`id`)) - ENGINE=InnoDB DEFAULT CHARSET=utf8;"); $db->query("CREATE TABLE IF NOT EXISTS {exif_records} ( `id` int(9) NOT NULL auto_increment, - `item_id` int(9) NOT NULL, + `item_id` INTEGER(9) NOT NULL, + `key_count` INTEGER(9) default 0, + `data` TEXT, `dirty` BOOLEAN default 1, PRIMARY KEY (`id`), KEY(`item_id`)) @@ -43,7 +38,6 @@ class exif_installer { static function uninstall() { $db = Database::instance(); - $db->query("DROP TABLE IF EXISTS {exif_keys};"); $db->query("DROP TABLE IF EXISTS {exif_records};"); module::delete("exif"); } -- cgit v1.2.3