Optimizing server-side relevance for sets

Hi everybody.
I have to get some properties from computers that are in several network (up to 3k).

(
				id of it,
				names of it,
				value of results (bes property "Network Address in use",it)|"NOIP",
				value of results (bes property "Network Mac Address in use",it)|"NOMAC"
)
			of bes computers whose (
					value of result (bes property "Default Gateway",it) is contained by set of ({the list of ips separated by ;})
)

but it takes too long
Any ideas to optimize this? Or other best practice to obtain the expected result?
Thanks in advance

Yes, the performance can be much improved following the guidance at Efficient Session Relevance Query for Computer Properties

1 Like

Thanks Jason, I didn’t know that topic and I optimized as much as possible.
However, I fear that the problem is related to the fact that having a set with many occurrences, performances get down
Here’s my new relevance:

(
id of item 0 of it  as string|"missing Computer ID",
name of item 0 of it|"missing Name"
, (concatenation ";" of values of results (item 0 of it, elements of item 1 of it))
, (if (size of item 2 of it = 1) then ((if it = "" then "Property 2: No values" else it) of concatenation ";" of values of results (item 0 of it, elements of item 2 of it)) else (if (size of item 2 of it > 1) then (("Property 2 duplicates: " & concatenation "|" of ((name of it) & "=" & (id of it as string)) of elements of item 2 of it) as string) else ("Property 2 does not exist")))
, (if (size of item 3 of it = 1) then 
	
	((if it = "" then nothing else it) of concatenation ";" of (values of results (item 0 of it, elements of item 3 of it)) whose (it is contained by set of ({list of ips})))
	else 
	(if (size of item 3 of it > 1) then (("Property 3 duplicates: " & concatenation "|" of ((name of it) & "=" & (id of it as string)) of elements of item 3 of it) as string) else ("Property 3 does not exist")))
) of (
elements of item 0 of it /*expand the computer set - gets you one line per computer*/
,item 1 of it
,item 2 of it
,item 3 of it
) of (
set of BES computers
, set of  bes properties whose (name of it = "Network Address in use") 
, set of  bes properties whose (name of it = "Network Mac Address in use") 
, set of  bes properties whose (name of it = "Default Gateway") 
)

{list of ips} in relevance are about 800
relevance evaluation time: over 15 minutes :frowning:

Can you test moving your set of (list of ips) to the bottom of the tuple and (item 4 ) ?

(
id of item 0 of it  as string|"missing Computer ID",
name of item 0 of it|"missing Name"
, (concatenation ";" of values of results (item 0 of it, elements of item 1 of it))
, (if (size of item 2 of it = 1) then ((if it = "" then "Property 2: No values" else it) of concatenation ";" of values of results (item 0 of it, elements of item 2 of it)) else (if (size of item 2 of it > 1) then (("Property 2 duplicates: " & concatenation "|" of ((name of it) & "=" & (id of it as string)) of elements of item 2 of it) as string) else ("Property 2 does not exist")))
, (if (size of item 3 of it = 1) then 
	
	((if it = "" then nothing else it) of concatenation ";" of items 0 of (values of results (item 0 of it, elements of item 3 of it), item 4 of it ) whose (item 0 of it is contained by item 1 of it))
	else 
	(if (size of item 3 of it > 1) then (("Property 3 duplicates: " & concatenation "|" of ((name of it) & "=" & (id of it as string)) of elements of item 3 of it) as string) else ("Property 3 does not exist")))
) of (
elements of item 0 of it /*expand the computer set - gets you one line per computer*/
,item 1 of it
,item 2 of it
,item 3 of it
,item 4 of it
) of (
set of BES computers
, set of  bes properties whose (name of it = "Network Address in use") 
, set of  bes properties whose (name of it = "Network Mac Address in use") 
, set of  bes properties whose (name of it = "Default Gateway") 
, set of ({list of ips})
)
3 Likes

Thanks @brolly33 :slightly_smiling_face:
I tried with about 800 ip addresses and it tooks about 8 seconds :sunglasses:
I think that’s the right way!
Many many thanks :wink:

1 Like