While using ‘expandSubResources = true’,it will expand sublists and subrecords. If the query parameter is not used, the response contains only the body fields of the record, and the sublists and subrecords are represented by links.
When ‘expandSubResources=true’ causes lagging or performance issues, it’s typically due to how it impacts the API request and response cycle. Here are some specific reasons why enabling expandSubResources=true might lead to lag:
Increased Data Transfer: When ‘expandSubResources=true’, the API server includes additional nested or related resources in the response. This can result in larger data payloads being transferred over the network. If the expanded sub-resources contain a significant amount of data or if the network connection is slow, this increased data transfer can cause delays.
Complex Queries and Joins: The server-side implementation of ‘expandSubResources=true’ might involve complex database queries or joins to fetch and aggregate related data. These operations can be resource-intensive, especially if they involve large datasets or inefficient database indexes.
Server Load: Processing requests with ‘expandSubResources=true’ may put additional load on the server, especially if the server is already handling many concurrent requests or if it lacks sufficient resources (CPU, memory).
Client-side Processing: On the client side, processing large amounts of data returned by ‘expandSubResources=true’ can lead to lag, especially on devices with limited processing power or memory.