Query slow when enabling distinct response

Options
Stefan Pointecker
Stefan Pointecker Member
edited October 2022 in ❓Other questions

Hi,

I have a query in one of my endpoints which queries table A with a Query all Records statement.

In this query I have two left joins to tables B and C. An entry from table A can have multiple entries in B and C.

To get only results from table A I need to enable the "Distinct" response in the output tab.

If I do so, the query takes more than 3 seconds to execute. If I set it to "automatic" the query takes only 0.2 seconds.

I really don't get why this is such a difference, if I try the same with mysql there is (almost) no difference in the execution time.

Update:

The reason I get multiple items in the response from table A is that I use an eval from table B, but the result of that is always true OR false for an entry from table A. (It should only indicate IF the left join to table B found an entry - I did not find a proper solution for that as to use a field from table B via eval)

If I remove the eval from table B the results are not duplicates with auto distinction.