From 01f2c0cb6a5be655072e5bdf519189b2305f9059 Mon Sep 17 00:00:00 2001 From: Simon Cozens Date: Thu, 5 Apr 2007 05:08:33 +0000 Subject: [PATCH] JOIN optimization. git-svn-id: http://svn.simon-cozens.org/memories/trunk@56 041978f6-d955-411f-a9d7-1d8545c9c3c7 --- Memories/SystemTag.pm | 5 ++--- Memories/Tag.pm | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Memories/SystemTag.pm b/Memories/SystemTag.pm index cdb8e14..3a9fbbf 100644 --- a/Memories/SystemTag.pm +++ b/Memories/SystemTag.pm @@ -6,10 +6,9 @@ __PACKAGE__->table("system_tag"); Memories::Photo->set_sql(sorted_by_system_tag => q/ SELECT photo.id as id, title, uploader, uploaded, x, y -FROM photo, system_tag, system_tagging +FROM photo, system_tagging WHERE system_tagging.photo = photo.id - AND system_tagging.tag = system_tag.id - AND system_tag.id = ? + AND system_tagging.tag = ? ORDER BY photo.uploaded DESC / ); diff --git a/Memories/Tag.pm b/Memories/Tag.pm index 59df4df..744a98a 100644 --- a/Memories/Tag.pm +++ b/Memories/Tag.pm @@ -5,10 +5,9 @@ __PACKAGE__->columns(Essential => qw/id name/); Memories::Photo->set_sql(sorted_by_tag => q/ SELECT photo.id as id, title, uploader, uploaded, x, y -FROM photo, tag, tagging +FROM photo, tagging WHERE tagging.photo = photo.id - AND tagging.tag = tag.id - AND tag.id = ? + AND tagging.tag = ? ORDER BY photo.uploaded DESC / ); -- 2.39.5