Skip to main content
1-Visitor
January 10, 2018
Question

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

  • January 10, 2018
  • 2 replies
  • 2198 views

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

2 replies

1-Visitor
January 10, 2018

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.

5-Regular Member
January 10, 2018

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);

}

ddas1-VisitorAuthor
1-Visitor
January 10, 2018

Thank You Raghu.

I will try this out and will post the result.

Regards,

Debdatta