Int property vs string property in performance

performance
(Michael Weston) #1

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 :slight_smile:

0 Likes

(DKumar) #2

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

0 Likes

(Michael Weston) #3

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

0 Likes