✨Discover storytelling in the AI age with Pixar's Matthew Luhn at Sanity Connect, May 8th—register now

How to Delete Unused Assets from Large Dataset - Timeout Error

1 replies
Last updated: Mar 23, 2021
Hey everybody, can somebody advise me on how to deal with deleting unused assets from a large dataset, my query gives me a timeout error. It works ok for smaller dataset. I would appreciate any help!
*[ _type in ["sanity.imageAsset", "sanity.fileAsset"] && count(*[ references(^._id) ]) == 0 ] [0..99]
Mar 23, 2021, 12:20 PM
Found a way around, just needed to reduce size of batch.. From [0..99] to [0..1]
Mar 23, 2021, 12:40 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?