🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Issue with attribute limits and document-level translations in Sanity.io

13 replies
Last updated: Oct 11, 2021
Hi there Sanity Team.We came across a problem that we didn’t antecipate before. We are getting an error in studio originated by : “Maximum number of unique attributes across all documents: 2000 attributes (advanced: 4000, enterprise: 10000 attributes)
” .
This is not explicit in the pricing information page and we have a client that is getting erros now and can’t save any document. If he had billing information will these limits change? The billing changed to (free, team, business, enterprise) and does not match to the documentation.

https://www.sanity.io/docs/technical-limits#c993b40e63df
Oct 6, 2021, 1:33 PM
Hey User! Thanks for pointing out the error in plan naming on the technical limits page. It should read:
Maximum number of unique attributes across all documents: 2000 attributes (team: 4000, business: 10000 attributes)
However, maximum attributes are explicitly listed in the
Pricing page under Included Usage > Unique attributes.
It should be noted that attributes are not available on a pay-as-you-go option. An increase in attributes does require an upgrade in plan.
Oct 6, 2021, 6:59 PM
Hi
user M
. Thanks for the clarification! So the only way to increase the attributes is upgrading to the team/business plan?
Oct 7, 2021, 10:19 AM
user M
i will try to elaborate our problem, because we are trying to do the math here and it’s hard to understand how the unique attributes are calculated. The site that have this problem have many languages (4 atm, but can be 14).I’m not completely sure that even by upgrading the plan it viable because your max unique attributes are 10k.
We designed the CMS in a “different” way. So we have many documents per page (each document represents a
section of the website) and we saw this : “An attribute here is considered to be any unique attribute/datatype combination, so an attribute 
attr
 containing a string, integer, and null value (in different documents) counts as 3 attributes.”Can you explain what does this means? and if we change the way we are building the pages ( instead of using several document types per page, using just one ) will it decrease the unique count?

This is a very sensitive point, because it’s a client that will have several markets, and several languages (10+). And we have it in production already, so we need to find a solution. The client cannot pay the business plan, but even if he could 10k document would not be enough for the long run.
This makes me think that mabey we are building the CMS the wrong way somehow because it’s a rather small Website.

Thanks in advance!
Oct 7, 2021, 10:39 AM
It can definitely be a bit tough to understand how atttributes are calculated. It helps to think of an attribute as a unique path through your content. There's a good explanation of it here .
It does sound like you need to do a bit of restructuring, as it sounds like your nested data structures are driving up your attribute count. It would probably also be helpful if you move your translations to the document level instead of the field level (if you haven't done so already).

There's a guide on best practices
here and I'm happy to help you think through it!
Oct 7, 2021, 6:08 PM
Ok
user M
. Thanks for your help! We are using this plugin -> https://github.com/LiamMartens/sanity-plugin-intl-input and we are using the
Simple translated object field
. This is exactly what you are mentioning. We are duplicating all the fields.This plugin have a
Document wide translation
too and it looks like it does not duplicate the fields. Can you help us figuring out if this is true?We will need to refactor everything and re-copy all the content, so we are trying to not make too many shots in the dark
😉
Many Thanks!
Oct 11, 2021, 10:42 AM
One more thing
user M
. Is there any command that we can use to see how many unique fields we are using? We are making some tests but in the sanity dashboard (under datasets) there is no instant update on the fields and it’s hard to know if our changes are making any good.
Oct 11, 2021, 2:36 PM
Ah, yes! It's usually the field level translations that hike up the attribute limits. I gave the International Input plugin a double check and it does confirm that you can do document level translations in this section , so I think that's the way to go.
You should be able to go to the following to see your attribute count:

https://<projectId>.<http://api.sanity.io/v1/data/stats/<datasetName|api.sanity.io/v1/data/stats/<datasetName>>

The attribute count is the value of fields.count.value and the limit is inside fields.count.limit
Oct 11, 2021, 4:06 PM
Ah, yes! It's usually the field level translations that hike up the attribute limits. I gave the International Input plugin a double check and it does confirm that you can do document level translations in this section , so I think that's the way to go.
You should be able to go to the following to see your attribute count:

https://<projectId>.<http://api.sanity.io/v1/data/stats/<datasetName|api.sanity.io/v1/data/stats/<datasetName>>

The attribute count is the value of fields.count.value and the limit is inside fields.count.limit
Oct 11, 2021, 4:06 PM
Ok
user M
! We are refactoring the studio right now. It’s a shame that the attribute count isn’t in real time so we can double check on the go. But i guess tomorow we will have a clear insight if this solves our problems. 🙂Cheers!
Oct 11, 2021, 4:23 PM
l
Oct 11, 2021, 4:32 PM
I agree that extra step is a bit of a hassle! I know in the past some folks have talked about creating some sort of dashboard plugin for the Studio that could display it. Either way, I'll bring this up internally!
Oct 11, 2021, 4:32 PM
l
Oct 11, 2021, 4:32 PM
Thanks!
So, we have some insights now :

1 document with 3 fields -&gt; 
http://www.buro.pt/KaQDyx locales -&gt; 
http://www.buro.pt/KF08dc atributes -&gt; 
http://www.buro.pt/ekUqql
Don’t understand why but the count of the unique atributes is still rising each time we create a new language. With 4 languages we had roughly 35 unique fields. When we had a new language it bumped up to 52, and we only have 3 fields in the whole studio (title, slug, portable text).
We are using the document level translation, so why is the count of the unique atributes changing?
We are following now an example code to test the count -&gt;
https://github.com/sanity-io/sanity-template-translation-examples
We are afraid of doing all the refactor and still end up in the same count
😕
Oct 11, 2021, 5:02 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?