I discovered today that alias length can affect query in a huge way. I'm doing a count query with some date filters, with indexes on date property (
NodeIndexSeekByRange
). Profiling this query i discovered that using an alias with 4 or less characters makes the query 25x faster than using alias with more than 4 characters. The NodeIndexSeekByRange
went from ~100 000 db hits to ~2700 db hits and total query db hits went from ~500 000 to ~21 000 by changing alias from 5 characters to 4 characters.(these are not my actual queries, but to illustrate my point)
MATCH (aaaaa:Node)
WHERE aaaaa.date < datetime($someDate) < aaaaa.date
RETURN COUNT(*) AS count
= 500 000 total db hits
MATCH (aaaa:Node)
WHERE aaaa.date < datetime($someDate) < aaaa.date
RETURN COUNT(*) AS count
= 21 000 total db hits
So apparently alias length can affect query planner in a huge way, is this covered in the docs?