I'm using Neo4j Version 4.2.0. community edition.
What is the maximum length of a string that can be assigned to a node or property?
I would think the most logical place on the docs to find this info would be here: Values and types - Neo4j Cypher Manual
I can't find the answer either on the docs here: Naming rules and recommendations - Neo4j Cypher Manual. The closest I found was that the length node, relationship, and property name can be up to 65,534 characters, but I don't think this refers to the string value of a property field.
I also searched stackoverflow and found these two answers posted 4 and 6 years ago, respectively:
These two SO are quite old so I'm not sure if they are relevant anymore. Is it still the case that there are no limits on the string length that can be stored as a property value on a node?
Since I'm using the community version of Neo4j, I don't have the ability to create node uniqueness constraints based on more than one property. As a result, I would like to know this information because I need to combine two fields in my data set (place+name) in order to create one property that I can use to identify unique nodes when I import data into Neo4j for the purposes of either 1) deleting old nodes, 2) updating the properties on existing nodes, and 3) creating new nodes found in the fresh data set.
because you are going to create node unique constraints this in turn is going to create an underlying index to support said constraint and to which then you are going to run up against
How can I find out if my unique property will be greater than the 8kB restriction on the key size limit stated on the doc you link to here? We have Neo4j running on a dedicated Linux VM with 30GB in Ram. We allocated 20GB in max and min heap in the config files.
There will be about 100,000 nodes under one label, and the unique property on the string could be as long as 100 characters because I'm concatenating two different strings (this process is being done in Python by the way). For example, name and location is the uniqueness constraint listed as "name-location."
And I guess this post is still valid then? Neo4j property string limit - Stack Overflow
There are no size limits to the string?
though not directly answering your question about maxlimit on strings and using Random string generator - Special i used this to generate a random string which had a length of 16000.
And then using the generated string such that I was then able to run
with `<random generated string of 16000 chars>` as longstring create (n: create (n:LongString) set n.p1=longstring;
this succeeded with
0 rows available after 133 ms, consumed after another 0 ms
Added 1 nodes, Set 1 properties, Added 1 labels
neo4j@neo4j> match (n:LongString) return size (n.p1);
| size (n.p1) |
| 16000 |
1 row available after 133 ms, consumed after another 11 ms
so we can certainly take a node to have a property which has a value of 16000 characters?
Ok, that looks good to me. In that case, I'll proceed to establish the uniqueness constraint based on the concatenation of two fields and I'll use this as the property that will define the node's uniqueness in Neo4j community edition.
Thank you for your help and references!