[thelist] optimising this mysql query

Dunstan Orchard dunstan at 1976design.com
Fri Nov 8 06:30:00 CST 2002

Hi there,

can anyone see a way of optimising this example query?
I only have an index on images.title

SELECT DISTINCT images.* FROM images LEFT JOIN imagekeyword ON
images.imageid=imagekeyword.imageid LEFT JOIN imageformat ON
images.imageid=imageformat.imageid LEFT JOIN imagelocation ON
images.imageid=imagelocation.imageid LEFT JOIN imagecategory ON
images.imageid=imagecategory.imageid WHERE MATCH (images.title) AGAINST ('dog
cat') OR imagekeyword.keyword like 'dog' OR imagekeyword.keyword like 'cat'
AND (imageformat.format like 'landscape' OR imageformat.format
like 'portrait') AND (imagecategory.category like 'Animals' OR
imagecategory.category like 'Non-urban') AND (imagelocation.location
like 'Australia' OR imagelocation.location like 'France')

I'm happy to provide more details if that's necessary, I just don't know what
you might need to see.

Thanks very much (could you CC me please if you can help?),

- Dunstan

Dorset, England

More information about the thelist mailing list