How to perform profiling on Composite DB Cypher Queries?

I have been working with Composite Databases on Neo4j in my local system. While running some queries, I encountered the "Neo.TransientError.General.MemoryPoolOutOfMemoryError." I know that increasing the transaction memory and heap size can help with this issue, but I want to optimize my Cypher query performance. For that, I want to check the profiling of my Cypher queries. Can anyone help me with query optimization and profiling of Composite DB queries?

Thanks for your question, but there is a lot of detail missing here.
What kind of deployment, what kind of memory setups, what kind of queries.
Also current metrics etc.

Best to open a official support ticket?