GraphQL product API is extremely slow when requesting variants

Hi there,

we are migrating from REST API to GraphQL API, as advised by Shopify. However, we have found that for queries like the following, the GraphQL API often takes more than 10 seconds in average, when a similar query with REST API takes just about 300 milliseconds.

Could you take a look in order to optimice it?

Kind regards, this is the query:

{
products(first: 250, query: “published_status:published”) {
nodes {
description
id
handle
productType
title
vendor
publishedAt
updatedAt
tags
featuredImage {
url
}
variants(first: 250) {
edges {
node {
id
title
availableForSale
compareAtPrice
barcode
price
sku
image {
url
}
}
}
}
}
pageInfo {
endCursor
hasNextPage
}
}
}

Hey Sinuhe, can you share your x-shopify-request-id that you can find in the response header for one of your slow GraphQL requests?

Hi,

sure. Just a comment, I am sharing the ‘x-request-id’ of the responses, and not the ‘x-shopify-request-id’ as you mentioned, as I could not find that header.

In the following cases, the average time of the GraphQL API response has been around 2 seconds, which is still much larger than the REST API 300 milliseconds.

  • c47735f5-cf64-45e3-a909-264a467ddbba-1732797069
  • fcdf55b9-e8a5-438e-a757-d6bd67ff0bc3-1732797066
  • 2ab9648d-da44-463c-96be-8857828acb77-1732797061
  • 14edd838-e3a1-4c73-997a-5ea811b45d25-1732797058
  • 787b9be2-efb2-4989-a9ba-a4643cbecfe0-1732797103
  • eb035eeb-e4c8-4b4d-8166-35bc4c743284-1732797101

Hope it helps :slight_smile: