Int vs string properties in performance

Hello,

I would like to know if there is a difference between int property or a string property in the following scenario:

I have multiple relations and every one of them have an "index" property.
Until now i have had strings of int in the property - "1", "12", "63".

Here is my question - Is there a difference (performance wise) between my current scenario to a scenario that the property is of type int?
If there is a difference, what is it?
What will be better, to use strings of number ("1", "2", "63") or actually int (1, 2, 63)?

thank you very much :slight_smile:

This is all just speculation but I this is how I think the data types would come into play:

Storage on disk - we know integers take up so many bytes and strings other bytes. Keeping in mind that Neo4j uses a lot of java under the hood, how they serialize the data to disk for the data files, the decision might come into affect there

Indexing or sorting - if it's a integer it'll sort and index in sequence: 1, 2, 3, 10, 100, 1000 vs. 1, 10, 100, 1000, 2, 3 if it was stored as a string.

Comparisons - if you're querying node.attribute >= 10. I predict that cypher will either have to do an implicit conversion on all attribute values if they're stored as a string or nodes will be skipped since their attributes are string and not integers.

But probably the biggest argument would just be the sanity of your DBAs. Even though Neo4j is schema optional, doesn't mean it has to be the wild wild west.