Dr Gerard Hammond <g.hammond-WwWqvNR902a3Zbb/[EMAIL PROTECTED]>
wrote:
Could somebody suggest an index(es) I could add to my sqlite v3 (REAL
SQL database) to make this SELECT faster?
SELECT date_trans, t.description, c.CategoryAbsolutePath, GST, total,
TransID, HasSplitTrans, t.categoryID, t.Currency, t.locked FROM
Transn t LEFT OUTER JOIN Category c on c.CategoryID=t.categoryID
and AcctID in (12) and t.categoryID in (261, 262, 263, 264, 265,
266, 267, 268, 269) ORDER BY date_trans
An index on Category(CategoryID). Another one on Transn(AcctID) or
Transn(AcctID, categoryID): the latter would be preferable over the
former if you have many distinct values of categoryID for each AcctID.
It may also help a little to replace the IN clause with
261<=t.categoryID and t.categoryID<=269
especially if you go with the composite index.
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------