So, I was optimizing a query I carried over from SQL, and I ran into a bit of a performance issue when compared to how it used to work in sql.
Basically, my php script is sending between 2 and 5 sets of two (numeric) values.
These have to be compare against id and doc from my collection's elements. Of course, the fewer elements in the predicate, the faster the query My for with predicate looks like this right now:
for $p in collection("/db/col1")//set1/page[(id eq val1 and doc eq altval1) or (id eq val2 and doc eq altval2) or (id eq val3 and doc eq altval3) or (id eq val4 and doc eq altval4) or (id eq val5 and doc eq altval5)]
I need to somehow write a predicate that changes depending on the number of values. I tried writing a function that writes the conditions and calling it in the predicate, depending on how many values are passed, but that didn't seem to work.
I would really appreciate if someone knows a workaround for this.
Edit: Removed a typo in the code.