Open robert-stuttaford opened 11 years ago
You're right that it's very important to consider the clause order when writing real world queries. However, I don't want to be bogged down in perfomance discussions this early in the tutorial. Maybe a link to an external performance/clause-order discussion or a separete perfomance chapter later on in the tutorial.
In
http://localhost:3000/chapter/2
: "The order of the data patterns does not matter (except possibly for performance)"It definitely matters :-) Datalog has no query optimiser; it'll execute clauses in the order given and take as long as it needs to do that. You should place your most restrictive clauses at the top so that successive clauses have less data to operate on.
Depending on the shape of your data, you can see orders of magnitude difference in query performance!