cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

QueryImplementedThingWithData service is executing pretty slow. Is there any other alternate

Newbie

QueryImplementedThingWithData service is executing pretty slow. Is there any other alternate

I have a Thing shape with around 20 Properties.

QueryImplementedthingsWithData service is working perfectly. but it's time consuming.

It's returning around 30 data in 36 seconds.

Is there any other alternate which can improve performance.

Regards,

Debdatta

3 REPLIES 3

Re: QueryImplementedThingWithData service is executing pretty slow. Is there any other alternate

Yes.  This is actually documented elsewhere here in the community that this specific service call is slower.  The faster way is to just get the implementing things and then loop through them to get only the specific things and specific data that you actually need.

Re: QueryImplementedThingWithData service is executing pretty slow. Is there any other alternate

Query Implementing things with Data fetches data for all the properties from the all thing instances. This would slow the performance if you have any image data. The best thing to do is get implementing things and then fetch only the properties that you need. Below is a simple example code that you can try.

The result set adds the Name and Desc columns to the end of result from prior query. You can simple extend this to include columns that you want from your template by modifying  types, columns and expression parameter withing if statement. I hope this helps !


var thingsList = ThingTemplates["GenericThing"].GetImplementingThings();

if (thingsList.rows.length > 0) {

    var params = {

       types: "STRING,STRING" /* STRING */,

        t: thingsList /* INFOTABLE */,

        columns: "Name,Desc" /* STRING */,

       expressions: "Things[name].name,Things[name].description" /* STRING */

    };

    var result = Resources["InfoTableFunctions"].DeriveFields(params);

}

Re: QueryImplementedThingWithData service is executing pretty slow. Is there any other alternate

Thank You Raghu.

I will try this out and will post the result.

Regards,

Debdatta