Performance optimization tips

Evaluating the performance of your API queries helps ensure optimal functionality, especially when working with large datasets or complex operations. While queries may appear efficient in smaller test environments, their behavior can differ significantly under production-like conditions, potentially leading to performance challenges. Inefficient queries, sorting strategies, or user permissions can lead to performance degradation in production environments. Comprehensive testing helps you identify and address these issues before deployment.

Disable count queries

When using TableViewConfig queries, the response includes both the actual data and the total number of rows matching your filter criteria. Calculating this total count requires a separate database request that is often slower than the data retrieval query itself.

To improve query response time, disable the count query by setting maxCountLimit to 0:

{  
    "TableViewConfig": {  
        "maxCountLimit": 0,  
        ...  
    }  
}

Use asynchronous exports instead of offset pagination

When exporting large datasets, the response size can exceed practical limits. While offset-based pagination allows you to retrieve data in chunks, performance degrades significantly as you move through pages, with each subsequent query becoming slower.

The recommended approach is to let the Output Module handle pagination automatically by submitting a single query to an asynchronous endpoint:

  1. Submit your query without displayLength to an asynchronous endpoint.
  2. Wait for the export job to complete.
  3. Download the generated export file.

This method is far more efficient than manually paginating through multiple pages.

Optimize sorting strategy

Sorting assets by attributes or by related asset properties such as name or attributes is computationally expensive from a database perspective.

Some best practices for sorting are:

  • Sort by the asset Id, fullName, or displayName when possible.
  • Avoid sorting altogether if it's not essential to your use case.

These simpler sorting approaches significantly reduce database load and improve query performance.

Use accounts with VIEW_ALL permission

When calling the Output Module using a regular user account, the results are filtered based on the view permissions of that user account. This filtering adds significant overhead to the database query, negatively impacting performance.

For automated exports, use an account that has VIEW_ALL permission. This eliminates the need for user permission logic in the database query, resulting in faster query execution and improved overall performance.