Thanks You Igor.

As the PRIMARY KEY of the table Category is CategoryID, is it necessary to specifically create an index of a primary key?



At 11:21 PM -0400 21/4/07, Igor Tandetnik wrote:
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




Good idea but...
Unfortunately the t.categoryID will not be such a neat series like this one.

Thanks!
--

Cheers,

Dr Gerard Hammond
MacSOS Solutions Pty Ltd
[EMAIL PROTECTED]  http://www.macsos.com.au

Proofread carefully to see if you any words out.

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to