I believe your issue is in the memory requirements you have created with the 8-dimensional cross product. This will generate (# of votes for selected daoId)^8 combinations before the filter to remove rows that have duplicate voters. This could be a huge number if the number of vote nodes returned is significant.
I tried refactoring the order of operations to eliminate the full 8-dimensional cross-product by performing it pair-wise, so the filtering can be applied incrementally.
I also used an apoc collections method to count the number of common votes between each tuple of 8 voters. This method may also be faster than the approach used in your query.
Give it a try to see if it is faster. I also don't have test data to verify it gives the same results, so be aware.
MATCH (d:Dao { daoId: '9ad9fb81-ad04-4830-85c2-212034072580' })<-[:IN]-(v:Vote)-[:BELONGS_TO]->(p:Proposal)
WITH v.voter AS voter, COLLECT(p.proposalNativeId + ":" + v.choice) AS votes
WITH COLLECT({voter: voter, votes: votes}) AS voterPatterns
UNWIND voterPatterns AS v1
UNWIND voterPatterns AS v2
WITH *
WHERE v1.voter < v2.voter
UNWIND voterPatterns AS v3
WITH *
WHERE v2.voter < v3.voter
UNWIND voterPatterns AS v4
WITH *
WHERE v3.voter < v4.voter
UNWIND voterPatterns AS v5
WITH *
WHERE v4.voter < v5.voter
UNWIND voterPatterns AS v6
WITH *
WHERE v5.voter < v6.voter
UNWIND voterPatterns AS v7
WITH *
WHERE v6.voter < v7.voter
UNWIND voterPatterns AS v8
WITH *
WHERE v7.voter < v8.voter
WITH *, v1.votes + v2.votes + v3.votes + v4.votes + v5.voters + v6.votes + v7.votes + v8.votes as combinedVotes
WITH *, [i in combinedVotes where i.count = 8 | i.item] as commonProposals
RETURN
[v1.voter, v2.voter, v3.voter, v4.voter, v5.voter, v6.voter, v7.voter, v8.voter] AS members,
SIZE(commonProposals) AS votedTogether,
commonProposals
ORDER BY votedTogether DESC
LIMIT 20
Note: the proposal assumes the 'votes' list contains distinct values per voter, thus we can look for a frequency of 8 in the combined list for each table of 8 voters. If this assumptions is not correct, you can add 'distinct' in the collect to enforce that.
WITH v.voter AS voter, COLLECT(distinct p.proposalNativeId + ":" + v.choice) AS votes