xpath - Is there a performance effect of using brackets instead of AND?
2
Performance wise, is there a difference between using AND and brackets in xpath expressions? Using brackets, the code is easier to read. So, if using brackets does not have any impact, I rather would use brackets, where possible. Writing an xpath expression for an OrderLine to be part of an Order and have a LineAmount greater than 10, I can do this two ways. And my question is, should I be using AND instead of brackets? 1) [OrderLine/Order = $Order] [OrderLine/LineAmount > 10] or 2) [OrderLine/Order = $Order and OrderLine/LineAmount > 10]
asked
Toon Verschoor
1 answers
3
As far as I know: No. You can compare the created sql statements by tracing the lognode ConnectionBus_Retrieve
The order of the statement has an impact on the performance. General rules are
Put the most discriminating on top, in most cases this is the assocation to the parent
Conditions on indexed attributes before non-indexed.
Limit the number of indexes, they 'll cost time and disk-space
Play around with the order when performance is key.