Relevance Query taking more that a minute to run. Need help to speed it up

I’ve have some relevance code that I use in several reports to fetch all the Users of bes computers.

(name of it, concatenation " <br>" of values of results from (bes property "User Name") of it as string) of bes computers

So far doing this has worked great and was really fast.

The problem is that at some point someone added a Site to the server that contained a property with an identical name. Since that Site has a numerically smaller Site ID than “ActionSite”, the other “User Name” Property appears first in the list of bes properties. The inspector “bes property < string >” only fetches the first property that matches the given string, so it can no longer be used to get the information I need.

I created the following query to try and replace the above query…

(name of it, concatenation " <br>" of values of results (bes properties whose (name of it = "User Name" and (item 0 of id of it) = 2299708709), it) ) of bes computers

This returned the correct information, but the run time was unacceptably slow. This went from a query that took less than a second to run, to a query that took over 1 minute.

Can someone help me find a solution to this that will give me the results I want at an acceptable speed?

There’s a great post at Efficient Session Relevance Query for Computer Properties describing how to make this more efficient and resilient. The main thing is to look up the BES Property once, rather than once for every computer.

1 Like

Thanks for the info, it was very helpful. I made a set of properties and fetched the correct info at a more appropriate speed. However, now it runs 1 second slower than the original query. I might be splitting hairs here, but is there any way to optimize it even further so that I can get back to (or at least closer to) the original runtime?

(names of item 0 of it, concatenation " <br>" of values of results (item 0 of it, elements of item 1 of it)) of (elements of item 0 of it, item 1 of it) of (set of bes computers, set of bes properties whose (id of it = (2299708709, 29, 1)))

As long as you are only retrieving one property, there may be.

Try
(names of computers of it, values of it) of results of bes properties whose (id of it = (2299708709, 29, 1)

If that’s a little faster you can add the HTML formatting as before.