Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

HunkyBill commented on Shop's SKU Count...there must be an easier way

$
0
0

Since there is no such thing as "Give me a count of variants (SKUs)", and the fastest API method is to 

  1. get all the products in a store. Since you get 250 per API call, this is relatively efficient, but slows considerably after the API limits are reached.
  2. each product provides a count of their variants without any API calls, so this become a simple sum in a loop of each product's variants

In a small store this is fast... but in a large one.. it is really slow... a sample benchmark of 3 runs is below.. note the tiny shop size. Tried with store with 70,000 products and ran into a brick wall on the practicality of this...

   user     system      total        real
   Getting 53 Products from Shopify...  SKU count  = 123

    0.020000   0.010000   0.030000 (  0.931971)
    0.030000   0.000000   0.030000 (  0.509388)
    0.030000   0.000000   0.030000 (  0.522662)

user     system      total        real
Getting 68730 Products from Shopify... SKU count 1014322
148.090000   2.970000 151.060000 (3371.578904)

So... that's a wee bit of a stretch there... 


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>