On 4/03/2009 2:12 PM, Peng Huang wrote:
> Hi Igor Tandetnik,
> 
> Thanks for your quick reply.
> 
> Your solution works. But in some cases, each y%d may has two or three
> choices. So the SQL will become very complex, we need ( 2 * 2 * 2 * 2) sub
> where statements. Does SQLite have some build-in features to optimize those
> kinds of SQL statements? Or do you have other suggestions to optimize the
> database of SQL statements?
> 
> For example:
> "SELECT * FROM py_phrase WHERE ylen = ? and (y0 = ? or y0 = ?) and (y1 = ?
> or y1 =? ) and (y2 = ? or y2 = ?) and (y3 = ? or y3 = ? or y3 = ?) ORDERY BY
> user_freq DESC, freq DESC"
> 

(y3 = ? or y3 = ? or y3 = ?)
is *logically* equivalent to
(y3 IN (?, ?, ?))

Does it run at the same speed?
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to