Hello everyone,

Hoping that I could get some help with a performance problem.  Using version
3.5.2

Here are the tables:
CREATE TABLE Objects (ObjectId INTEGER PRIMARY KEY, Name TEXT)
CREATE TABLE Keywords4Objects (ObjectId INTEGER, KeywordId INTEGER)
CREATE TABLE Keywords (KeywordId INTEGER PRIMARY KEY, Keyword TEXT NOT NULL
COLLATE NOCASE UNIQUE)

The Query:
SELECT DISTINCT o.ObjectId, o.Name
                    FROM Objects o
                    LEFT OUTER JOIN Keywords4Objects ok ON ok.ObjectId =
o.ObjectId
                    LEFT OUTER JOIN Keywords k ON k.KeywordId = ok.KeywordId
WHERE
                    k.Keyword LIKE 'abc' OR o.Name LIKE 'abc'

Initially, I was just using a join, but objects without keywords were not
getting picked up.  When I switched to Left Outer Joins.  I got the objects
that don't have keywords, but the query is unbearably slow.  It went from
being instantaneous to over a minute.

Any ideas?
Thanks in advance.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to