Relation Type containing a Date - Optimization

Hey guys I have this model:

CREATE (myInfo:Info {hash:'some hash'})
CREATE (Keanu:User {name:'Keanu Reeves'})
CREATE (Keanu)- [:INFO_DETECTED_ON_2020_05_04] - >(myInfo);

I want to be able to retrieve relation based on the date in the relation type, I was told that (by listening to video the secret neo4j sauce) that this was optimal if I need to search for a specific date, or a range of date (between)

Here is the query I came up with, to get the last 30 days info that are in the database.
I find it a bit dirty and I am not sure it is performing fast
How can I make sure my query is fast, I have difficulity understanding the output of PROFILE on the query. any help appreciated :slight_smile:

// Get the info from the last 30 days from the relation name - Needs to be fast
PROFILE MATCH (User)- [r] - (info:Info)
WHERE  (type(r)) STARTS WITH 'INFO_DETECTED' AND
datetime() - duration('P30D') < datetime({year:toInteger(substring(type(r), size(type(r))- 10, 4)), month:toInteger(substring(type(r), size(type(r))- 5, 2)), day:toInteger(substring(type(r), size(type(r))- 2, 2))})
RETURN info;

Some example to replicate

// some query example, to show what type of query we could be doing in Neo4j with good performance
CREATE (myInfo:Info {hash: 'hash1'})
CREATE (myInfo2:Info {hash: 'hash123'})
CREATE (Keanu:User {name: 'Keanu Reeves'})
CREATE (Max:User {name: 'Max Blais'})
CREATE (Max)-[:_2020_01_01]->(myInfo)
CREATE (Max)-[:_2020_01_03]->(myInfo2)
CREATE (Keanu)-[:_2020_04_04]->(myInfo)
;

// Get the Info from the last 365 days from the relation name
MATCH ()-[r]-(info:Info)
  WHERE  (type(r)) STARTS WITH '_2' AND
  datetime() - duration({days: 365}) < datetime({year:  toInteger(substring(type(r), size(type(r)) - 10, 4)),
                                                 month: toInteger(substring(type(r), size(type(r)) - 5, 2)),
                                                 day:   toInteger(substring(type(r), size(type(r)) - 2, 2))})
RETURN DISTINCT (info);

// Find all user that have the same info
MATCH
  (user:User)-[r]-(info:Info)
  WHERE  (type(r)) STARTS WITH '_2'
  AND (info.hash = 'hash1' OR info.hash = 'hash123')
RETURN user, collect(info.hash) AS valueFound

Question answered in Filtering by Relationship Type - Contains
can be closed