# Is there a max file size for the named query export to csv button?

**URL:** <https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546>\
**Category:** Ignition\
**Tags:** namedqueries\
**Created:** [March 2, 2023, 5:58pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546 "2023-03-02T17:58:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dustin\_Castleberry](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Dustin\_Castleberry](https://forum.inductiveautomation.com/u/Dustin_Castleberry)\
**Post date:** [March 2, 2023, 5:58pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/1 "2023-03-02T17:58:43Z")

</div>

I have a named query with over 10 million rows that I'm trying to export to csv. When I press the export to csv button the file select window doesn't popup. If I limit it to something like 900000 rows then it works like normal. Is there a known limit to rows or file size for the export to csv function?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 2, 2023, 6:07pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/2 "2023-03-02T18:07:34Z")

</div>

The only 'limit' is how much memory the designer has, which is _likely_ being exceeded because the 10,000,000 rows is directly from the table model.

I would _strongly_ suggest doing this operation with a script, rather than relying on the export CSV button. Or, you know, just don't make a 10,000,000 row CSV file.

---

<div class="post-metadata">

**Author:** ![Dustin\_Castleberry](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Dustin\_Castleberry](https://forum.inductiveautomation.com/u/Dustin_Castleberry)\
**Post date:** [March 2, 2023, 7:10pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/3 "2023-03-02T19:10:49Z")

</div>

Thanks. Normally I wouldn't do it this was but I was asked to do it this way. We are in the process of moving cloud servers and don't currently have direct access to the windows box that runs the database. I also get the same memory error if I run this as a script.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 2, 2023, 7:14pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/4 "2023-03-02T19:14:07Z")

</div>

It's probable there's some kind of error in the output console that will give you a clue as to what's going on.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [March 2, 2023, 7:19pm UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/5 "2023-03-02T19:19:22Z")

</div>

I would run this operation from a script and batch it using a limit to say 100,000 rows or so, and then just append the rows into a dataset object or directly into the file.

---

<div class="post-metadata">

**Author:** ![Dustin\_Castleberry](https://avatars.discourse-cdn.com/v4/letter/d/6f9a4e/32.png) [@Dustin\_Castleberry](https://forum.inductiveautomation.com/u/Dustin_Castleberry)\
**Post date:** [March 3, 2023, 1:42am UTC](https://forum.inductiveautomation.com/t/is-there-a-max-file-size-for-the-named-query-export-to-csv-button/70546/6 "2023-03-03T01:42:55Z")

</div>

I raised the designer memory to 4gb. This fixed the memory issue. This is the script I am using for anyone who may come across this thread.

table = system.db.runQuery("SELECT sqlt\_data\_1\_20230125.\* FROM sqlt\_data\_1\_20230125")  
csv = system.dataset.toCSV(dataset = table, showheaders = True, forExport = False)  
filePath = "C:\Users\DustinCastleberry\Documents\SQL\_Backup\sqlt\_data\_1\_20230125.csv"  
system.file.writeFile(filePath , csv)

I am trying to import the data into a new MySQL database but I get an error with anything that has a null value when trying to import.
