[Kmymoney-devel] Anyone good with SQL?

Mikael Kujanpää mahead80 at nic.fi
Thu Aug 11 07:50:29 UTC 2011


 On Thu, 11 Aug 2011 03:13:47 -0400, Eric A. Bonney wrote:
> "SELECT transactionId AS _id, payeeId, valueFormatted, memo,
> postDate, name FROM kmmSplits, kmmPayees WHERE (kmmSplits.payeeID =
> kmmPayees.id AND accountId = ? AND txType = 'N') UNION SELECT
> transactionId, payeeId, valueFormatted, memo, postDate, checkNumber
> FROM kmmSplits WHERE payeeID IS NULL AND accountId = ? AND txType =
> 'N' ORDER BY postDate DESC LIMIT 50"
>
> The '?' get filled in with the actual accountId the user has
> selected. I am currently limiting the return to 50 records as you can
> see but this does nothing to speed up the query, so it might as well
> be dropped.

 I'm sorry, I can't help you, but I thought just to mention that because 
 you order your results by postDate in latter query, the whole query must 
 be fetched and therefore taking 50 of them doesn't speed up it at all. 
 Creating indexes would probably help if there aren't any, but I have no 
 idea how sqlite supports them.

-- 
 Mikki


More information about the KMyMoney-devel mailing list