Help

Upcoming database upgrades. Airtable functionality will be reduced for ~15 minutes at 06:00 UTC on Feb. 4 / 10:00 pm PT on Feb. 3. Learn more here

Do lookup fields of attachment fields count against attachment size limit?

Topic Labels: Base design
477 3
cancel
Showing results for 
Search instead for 
Did you mean: 

We’re getting right at the upper limits of our attachment file size (20GB for the pro plan). It’s not going to make sense to upgrade to Enterprise, and we have plenty of space left for more records (35K now, and we will be archiving old records before we hit that limit). We’ve used
Calculate Airtable Attachment File Sizes to figure out the biggest attachments and remove and archive them just as a stopgap until we systematically archive. My question is, when you have an attachment in one table, and look it up in another table, does that attachment count twice against your attachment size limit or only once?

3 Replies 3

It should only count once. You may want to look into the available integrations with services like Google Drive or Dropbox – you could add and remove attachments using an automation, for example, to keep your attachment space usage in check.

You can use my script to quickly evaluate size of all attachments in tables of all base. Lookups shouldn’t count, but when you remove some records and they still stored in history and available to restore, it still counts (script doesn’t add them).

const inMb=(bytes)=>(bytes?`${Math.round(bytes/Math.pow(1024,2))} Mb`:'');const ts=[];
for(var table of base.tables) ts.push(await count(table))
if (sum(ts)) {output.table(ts.filter(n=>n).map(x=>(x?{size:inMb(x.size),name:x.tname}:{})));
output.markdown(`**Total: **${inMb(sum(ts)?.size)}`)}

function sum(arr){return (!arr||!arr.length||!(arr.some(n=>n)))? null:
{size:arr.filter(n=>n).map(x=>x.size).reduce((x,y)=>x+y),tname:table.name}};
async function count(table){
  let flds=table.fields.filter(fld=>fld.type.includes('Attach'));
  let query=await table.selectRecordsAsync({fields:flds});
return sum(flds.flatMap(fl=>query.records.map(x=>x.getCellValue(fl)).map(sum)));}

@Alexey_Gusev This script is great. Thank you for sharing. Previously I had to look in each table on the bottom of the page in the summary footer to see the total attachment size (it’s per field total only).

image_2022-02-20_120051