Query Runtime Optimizations

Query Runtime Optimizations

  

Hi All!

Is there a way to disable the query optimizations that the platform does on the aggregates, and the SQL queries (formerly known as Advanced Queries) during debug?

An example:

In this action



when I stop at the For Each node I see this
Now, I don't think I'm alone in thinking that knowing how many records the query returned is useful information, am I?

But hey, maybe I can see the actual records? That's also useful, right?
Thing is, while this only shows one record, the For Each node actually loops two times, which makes sense because when I test the SQL query with the exact same input parameters, I get this:
So, is there a way to disable the runtime optimizations while debugging so that the debugger actually shows what's happening?



Hello,

I don't know any way of doing this, as the debug will use the exactly same code that is generated when publishing.

A workaround is to "use" the variables like length, so they are not optimized...

Cheers

Carlos,

The only way I'm seeing of achieving (or trying to achieve) that is encapsulate your query in an action.

But you'll probably won't want to do that. Unless it's a very specific scenario you're trying to debug.

I've not tested this option.

Just to add to what @João said.

When you "separate" an aggregate to a Server Action, setting as output the list returned by the aggregate, the platform does not optimize anymore the aggregate, as now it does not know how to do that (the aggregate becomes out of a specific context).

You can extract your aggregate to an action automatically, with the new versions of the Service Studio, debug, and than reversing the procedure after you find the problem, but I think this is "too much" in general.

Cheers.