Hello, anyone can reply to this question, I try to upload a file size of 2MB but fail, but less than 1MB will succeed.
I really want to know the limit of String Scale. Thanks in advance.
There has never been stated a specific limit, but there must be one at some point. I would also like to know from the @core-devs or maybe @MichelDiz might know?
The question was related to String type.You are probably confusing with some limitation in Dgraph Cloud. Obviously it isn’t 2MB if there is one. It could have a technical, non-confirmed, limit of 2GB. But Manish once said that there’s no such thing.
I host Dgraph in my windows system, I use Retool with graphql update mutitation to test my case, I upload the file of JPG or PDF(encode to base64 String first), when the size is more than 750K, the upload is sucessful, but the update mutitation don’t change the last string data, the graphql request still return the last string data instead of updated base64 string, the status code of response is “200”, but I think it is Fail.
When the size of JPG/PDF is less than 700K, the upload mutitation will be successful too, but the graphql request will return the corrected updated string data.
The Retool docs show their file input component support up to 40MB. so I think the problem is caused by Dgraph.
In fact, there is a hard-coded maximum value size of 1MiB (in Dgraph v21.12.0, which is using BadgerDB commit 3f320f5df1bf; link to code where the size check happens); the over-sized key-value is ignored and the error is not propagated to the client, but it gets logged (see here). This is not the expected behavior, right?
@MichelDiz I’m assuming there is still this 1Mb on string size? Working on debugging a project with extra long input strings to filter with (not storing) and seeing something similar. If we break up the string all works find.
Index tokens for string data type is the hash (usually sha256) for hash index, exact value for exact index. Essentially, if you have an exact index on a string predicate, your values have to be smaller than 64KB (even smaller than that because predicate name also takes some space).
I have an internal proposal for validating sizes before applying a schema or a mutation. Let me put it out for comments. We merged the PR 8623 as part of the same proposal. We also plan to support larger sizes in future and not allow exact indexes for such data types.