cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Int property vs string property in performance

o9384496
Node Link

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 between my current scenario to a scenario that the property is of type int?
If there is a difference, what is it?

thank you very much

3 REPLIES 3

Hi @o9384496,

You will have data type mismatch when querying an int when it's actually a string.

When you are searching for the string as an "int" you should use Scalar functions like toInteger() for queries. -->

https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-tointeger

to check the datatype of the property use type(property). -->
https://neo4j.com/docs/cypher-manual/current/functions/scalar/#functions-type

Yes I know.
My question was what is the best way, to use an int or a string.
Of course my queries will use the data type that is in the db

Hi @o9384496,

I don't know how extra process Neo4j is doing on ints and strings but
I think int is better because it uses just 8 bytes, also usually most of its bits are 0, so needs lesser processes.