Hello, I have a query that is slowing down my application significantly; in some cases, it takes 20+ seconds (this is in a SQLite database in an iPhone app, which is why it is so slow - the iPhone doesn't have as much system resources). If anybody could help me optimize this query, I'd appreciate it very much.
The situation is this: there is a table, "cards", which I am searching. Each card has a card_id, name, text, etc. There is also a table "card_tags" which has only the rows "card_id" and "tag", because a single card may have several tags. The query I'm trying to execute is attempting to search the card's name, text, OR any of its tags for a specific search string. Here's the query I've constructed that is operating slowly: SELECT DISTINCT cards.* FROM cards LEFT JOIN card_tags ON cards.card_id=card_tags.card_id WHERE (cards.name LIKE '%query%' OR cards.text LIKE '%query%' OR card_tags.tag LIKE '%query%') Any help would be appreciated! -- View this message in context: http://www.nabble.com/Query-Optimization-Help-tp21958799p21958799.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users