MySQL Forums
Forum List  »  Full-Text Search

Efficiency of my select statement
Posted by: john d
Date: April 27, 2010 03:19PM

Which is preferred for efficiency, as I need to search for term ie. boxes in all fields outlined below:

SELECT Title,Description,Program,Producers,Format,Date_Made FROM table1
WHERE id='boxes' OR Program like '%boxes%' OR Title like '%boxes%' OR Producers like '%boxes%' OR Key_Words like '%boxes%'
UNION
SELECT Title,Description,Program,Producers,Format,Date_Made FROM table1
WHERE MATCH(Description) AGAINST('boxes');

or

SELECT Title,Description,Program,Producers,Format,Date_Made FROM table1
WHERE id='boxes' OR Program like '%boxes%' OR Title like '%boxes%' OR Producers like '%boxes%' OR Key_Words like '%boxes%'
AND MATCH(Description) AGAINST ('boxes');

or is there another way altogether i should be looking at this?

Note: Description is the only column defined with a Fulltext index;

Options: ReplyQuote


Subject
Views
Written By
Posted
Efficiency of my select statement
4766
April 27, 2010 03:19PM
1923
April 29, 2010 04:14PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.