# Load CSV data

**URL:** <https://community.neo4j.com/t/load-csv-data/58221>\
**Category:** Neo4j Graph Platform\
**Tags:** migrated\
**Created:** [December 30, 2022, 3:23pm UTC](https://community.neo4j.com/t/load-csv-data/58221 "2022-12-30T15:23:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AttieV](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/attiev/32/27926_2.png) [@AttieV](https://community.neo4j.com/u/AttieV)\
**Post date:** [December 30, 2022, 3:23pm UTC](https://community.neo4j.com/t/load-csv-data/58221/1 "2022-12-30T15:23:33Z")

</div>

Hi, I previously loaded data from CSV file using Cypher: :auto using Periodic Commit 20000 - with no memory issues. It seems that periodic commit is not available in the new version, replaced by CALL {....} IN TRANSACTIONS OF X ROWS. But now I get an out of memory error, even if I make X very small (10). The dataset is big but always worked with the periodic commit. It now loads about 500 000 nodes and then I get the out of memory error. I probably need to switch to admin bulk import tool going forward but in the interim would like advice on how to resolve this memory issue.

Thanks, appreciate the assistance.

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [December 30, 2022, 4:46pm UTC](https://community.neo4j.com/t/load-csv-data/58221/2 "2022-12-30T16:46:27Z")

</div>

Can you share your code?

---

<div class="post-metadata">

**Author:** ![AttieV](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/attiev/32/27926_2.png) [@AttieV](https://community.neo4j.com/u/AttieV)\
**Post date:** [December 30, 2022, 7:17pm UTC](https://community.neo4j.com/t/load-csv-data/58221/3 "2022-12-30T19:17:47Z")

</div>

Hi, thanks for the response. This is the code:

```auto
:auto load csv with headers from "file:///nodes.csv" AS clients
CALL{
    WITH clients
    CREATE (c:Client 
      {cust_no: TOINTEGER(clients.cust_no),
       name: clients.name}
    )
} IN TRANSACTIONS OF 100 ROWS

```

Thanks

---

<div class="post-metadata">

**Author:** ![glilienfield](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/glilienfield/32/27534_2.png) [@glilienfield](https://community.neo4j.com/u/glilienfield)\
**Post date:** [December 30, 2022, 8:35pm UTC](https://community.neo4j.com/t/load-csv-data/58221/4 "2022-12-30T20:35:08Z")

</div>

hum....that is the same way I would have written the query. You could try the apoc equivalent to see if it is any better. I set 'parallel' equal to true, since you are only creating nodes there will not be potential locking issues.

```auto
CALL apoc.periodic.iterate(
  'load csv with headers from "file:///nodes.csv" AS clients return clients',
  'CREATE (c:Client 
      {cust_no: TOINTEGER(clients.cust_no),
       name: clients.name}
    )',
  {batchSize:10000, parallel:true}) yield total
return total

```

---

<div class="post-metadata">

**Author:** ![AttieV](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/attiev/32/27926_2.png) [@AttieV](https://community.neo4j.com/u/AttieV)\
**Post date:** [January 1, 2023, 11:06am UTC](https://community.neo4j.com/t/load-csv-data/58221/5 "2023-01-01T11:06:03Z")

</div>

Thanks! the apocalypse procedure worked.
