optimise the common case, but speak slowly and use simple words, so that mysql can understand

git-svn-id: file:///home/shish/svn/shimmie2/trunk@217 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-07-04 15:29:40 +00:00
parent 2fcb9e168e
commit c8bc08f7da

View file

@ -158,7 +158,9 @@ class Database {
}
else if($positive_tag_count == 1 && $negative_tag_count == 0) {
$query = new Querylet(
"{$this->get_images} WHERE images.id IN (SELECT image_id FROM tags WHERE tag LIKE ?) ",
// MySQL is braindead, and does a full table scan on images, running the subquery once for each row -_-
// "{$this->get_images} WHERE images.id IN (SELECT image_id FROM tags WHERE tag LIKE ?) ",
"SELECT *,UNIX_TIMESTAMP(posted) AS posted_timestamp FROM tags, images WHERE tag LIKE ? AND tags.image_id = images.id ",
$tag_search->variables);
if(strlen($img_search->sql) > 0) {