BAQ executes in 8 seconds in BAQ Entry, but never finishes with REST Call

10.2.500.8 (I know it’s old)…

I am running this BAQ in 6-8 seconds via BAQ Designer, but the REST call to it never finishes…

I saw other posts on here talking about performance issues with BAQSvc from rest with even older versions that have since been fixed…

I don’t really get it. Anyone have any clues?

Usually you have a stuck cache. Try using the OPTION(RECOMPILE) or OPTION(OPTIMIZE-FORUNKNOWN) hacks in the forum to get past it.

1 Like

And I choose QueryOption as the setting?

If you are in 2023 then yes its in the Options to add otherwise you have to hack it via a group by or calculated field.

I’m on 10.2.500.8…

so I would create a calculated field and put that statement in there?

Its hacky, check out the post above I think it has some examples on how to do it. Hold on let me find it.

Here’s one

Also, this ONLY affects this one query, right?

Yes its only one query.

I don’t have an ORDER BY clause in my SQL query, it’s still fine if I use that in the execution settings?

Yeah it will add one. it will add ORDER BY 1 (which is no sort at all but that’s fine)

YOU Can also try OPTION(RECOMPILE) instead of OPTIMIZE FOR UNKNOWN.

I’ll try both man, thank you. I am trying optimize for unknown right now, but up to 1 minute and 30 seconds already on this rest call so…

Had to do the persists in query and I think I had to add another execution setting to get it to save, idk. Thanks a ton Jose.

For the record I did read those posts and try that prior to posting, but I wasn’t doing it right.