SORT in neo4j seems to take higher db hits

Hi Team,

I am using neo4j version 4.4.19. We deal with an application that handles large sets of document nodes. Sort on the listing queries takes greater db hits. Please help here.

the below is some sample part of the query, where there are many sort parameters. Based on the user selection.

....WITH document,
CASE
WHEN sortBy='VersionDate' THEN document.version
WHEN sortBy='Title' THEN TRIM(TOLOWER(document.title))
WHEN sortBy='Source' THEN document.source
END AS sortVal
ORDER BY
CASE
WHEN sortOrder='Ascending' THEN sortVal ELSE NULL END
ASC,
CASE
WHEN sortOrder='Descending' THEN sortVal ELSE NULL END
DESC,document.GUID ASC
SKIP 0 LIMIT 10
RETURN document

Assuming that you added this WITH statement to do the sort, your additional db hits are from accessing the properties. Accessing a property causes database activity. Unlike a relational database where accessing the record gets all the columns, graph retrieves the properties only when needed.