- Each request requires a full network round trip
- Sequential requests increase the total loading time
- Multiple requests create unnecessary overhead
- Reduces network overhead by making one request instead of many
- Improves performance through parallel query execution
- Provides a better user experience with faster load times
Example dataset
In the following example, we’ll use the same data that we used in our Quickstart. It contains sales data from taco restaurants, and it has the following structure, shown in the table below:Combine multiple queries into one request
Suppose you want to show three charts on your dashboard:- Total taco sales in dollars plotted over time
- The number of taco sales plotted over time
- Top-performing restaurants with the most revenue
- Single request efficiency: Instead of making three separate API calls, we combined all queries into one GraphQL request. This reduces network overhead and improves performance.
-
Query naming: Each time series query has a unique name (
revenue
andorderCount
) to prevent naming conflicts. This makes it easy to identify and access specific data in the response. -
Response structure: The JSON response organizes results by query name:
revenue
: Contains revenue data over timeorderCount
: Contains order count data over timeleaderboard
: Contains the top restaurants by revenue