Skip to main content

512MB memory limit in an automation script

  • April 23, 2021
  • 4 replies
  • 54 views

Forum|alt.badge.img+5

I am trying to run the following script:

const tableDeals = base.getTable("Deals")
const queryDeals = await tableDeals.selectRecordsAsync()

And I am getting an error “Your script exceeded the 512MB memory limit.”.

Though the Deals table has only about 3500 records and weighs about 4 MB. What am I doing wrong and how can I fix this? Thanks!

4 replies

Forum|alt.badge.img+12
  • Participating Frequently
  • July 10, 2021

Do you have any updates from Airtable about this @Sergey_Filimonov ?


Justin_Barrett
Forum|alt.badge.img+21

The selectRecordsAsync method automatically collects all fields from all records. This a) takes more processing time for large tables, and b) could potentially eat a lot of memory with high record counts and lots of fields and data. It’s best to only collect the fields needed later in the script. This is done by passing an object to selectRecordsAsync with a “fields” property that contains an array of field names.

const queryOrders = await base.getTable("Orders").selectRecordsAsync({
    fields: [
        "Field Name 1",
        "Field Name 2"
    ]
})

Only those field names listed can be used later in the script for things like getCellValues, etc.


Forum|alt.badge.img+2
  • New Participant
  • January 31, 2022

The selectRecordsAsync method automatically collects all fields from all records. This a) takes more processing time for large tables, and b) could potentially eat a lot of memory with high record counts and lots of fields and data. It’s best to only collect the fields needed later in the script. This is done by passing an object to selectRecordsAsync with a “fields” property that contains an array of field names.

const queryOrders = await base.getTable("Orders").selectRecordsAsync({
    fields: [
        "Field Name 1",
        "Field Name 2"
    ]
})

Only those field names listed can be used later in the script for things like getCellValues, etc.


This worked like a charm. Thank you!


Forum|alt.badge.img+7
  • Participating Frequently
  • June 14, 2023

The selectRecordsAsync method automatically collects all fields from all records. This a) takes more processing time for large tables, and b) could potentially eat a lot of memory with high record counts and lots of fields and data. It’s best to only collect the fields needed later in the script. This is done by passing an object to selectRecordsAsync with a “fields” property that contains an array of field names.

const queryOrders = await base.getTable("Orders").selectRecordsAsync({
    fields: [
        "Field Name 1",
        "Field Name 2"
    ]
})

Only those field names listed can be used later in the script for things like getCellValues, etc.


Fantastic, thank you.