@niko963 Not directly related, but we have an issue in datahike that might be due to the datascript query engine: https://github.com/replikativ/datahike/issues/7. I still need to look into it more closely, have been busy with academic duties unfortunately. It would be good to know if this issue can be reproduced with the datascript query engine.
This one looks like it's due to join participants being resolved in isolation. E.g. the fact that (conceptually, and in DataScript) [2 ?p ?v] => (d/datoms :eavt 2)
whereas [?s ?p ?v] => (d/datoms :eavt)
Still seems an order of magnitude off in absolute numbers though... And the worst-case optimal approach should be robust to clause ordering.
Do you have the dataset for this? I could give this a go.