cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Memory issues using apoc.export.csv.data

Hi,

I am running into memory issues while running:

MATCH (a:alias)-[rel]-(:alias)
WITH collect(DISTINCT a) AS Alias, collect(rel) AS related_to
CALL apoc.export.csv.data(Alias, related_to, "ALIAS_ALIAS.csv",{})
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data

Neo.TransientError.General.OutOfMemoryError: There is not enough memory to perform the current task. Please try increasing 'dbms.memory.heap.max_size' in the neo4j configuration (normally in 'conf/neo4j.conf' or, if you you are using Neo4j Desktop, found through the user interface) or if you are running an embedded installation increase the heap by using '-Xmx' command line flag, and then restart the database.

When I use another apoc procedure on top of this export

CALL apoc.periodic.iterate(
	"MATCH (a:alias)-[rel]-(:alias)
	RETURN collect(DISTINCT a) AS Alias, collect(rel) AS related_to",
	"CALL apoc.export.csv.data(Alias, related_to, "ALIAS_ALIAS.csv",{})
	YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data",
	{batchSize:5000})
YIELD batches, total, errorMessages

I get syntax issues. How can I work around these and successfully export?

Thanks

1 REPLY 1

Based on the suggestion at Export relation to CSV to just use apoc.export.query, I changed the query to

CALL apoc.export.csv.query("
MATCH (a:alias)-[rel]-(b:alias)
RETURN a, b,rel",  "output1.csv", {batchSize:5000})
YIELD batches, total, errorMessages

Just wondering though if the output can be compressed to look like what the bellow querry with collect() and apoc.export.csv.data could return:

MATCH (a:alias)-[rel]-(:alias)
WITH collect(DISTINCT a) AS Alias, collect(rel) AS related_to
CALL apoc.export.csv.data(Alias, related_to, "output2.csv",{})
YIELD file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data
RETURN file, source, format, nodes, relationships, properties, time, rows, batchSize, batches, done, data