Query Optimization Strategy

A frequent question we get is how to optimize a query when a simple query to get orders has a cost of over 10,000. The reason for that is the lack of a limit which causes the cost analyzer to default to 100.

So a query for orders with line items is analyzed as asking for 100 orders with 100 line items each: 100 * 100 = 10,000.

To get around that, include a first argument and use the hasNextPage field to get more results if needed.

See https://developer.shiphero.com/getting-started/#optimizingAQuery for more details.

If you have any questions or other optimization ideas, please share below!