Hello, The Mendix best practice for XPath advises to do the following: “each constraint must be put in brackets ([ ]) separately, instead of using the and keyword”. The only other thing I could find about this situation was a forum question of 4 years ago, which suggests that there is no performance difference. I would like to know what the differences in execution are between using brackets, and the ‘and’ keyword. I have heard people saying that using the ‘and’ keyword makes sure that the order of the provided constraints is guaranteed, which is why I always use ‘and’. Hopefully somebody has a definitive answer or insight in what the actual differences between the two options are. Greetings Martin
I’m afraid the documentation is wrong, I’ll make sure it gets fixed. Meanwhile, the answer is that there is no difference. At an early stage of query processing, both constructs are turned into the same internal data structure.
In the end, we generate SQL that is sent to the database. Even if the clauses in the SQL would be ordered differently, the database is free to ignore this and choose the best query plan regardless. There is no guarantee of evaluation order of the constraints.