Select to view content in your preferred language

Ballooning Feature Layer Size

290
14
Friday
mpboyle
Frequent Contributor

We have a feature layer that over the past couple days has ballooned in size with no reasonable explanation I can find.

This feature layer contains approximately 11k line features and less than 10 fields. Every 10 minutes the feature layer has all rows deleted and replaced using a feature set and the Python API.

This morning I manually overwrote the feature layer, and the item size was around 5MB.  A few hours later, the item has ballooned in size to 250MB!?!  

The feature layer does NOT have editing enabled, no associated views, no extra indexes, does NOT have optimize layer drawing enabled, and no attachments.

Is there any reasonable explanation for why this feature layer continues to balloon in size?

0 Kudos
14 Replies
D_Atkins
Frequent Contributor
0 Kudos
mpboyle
Frequent Contributor

Editing is not enabled, sync not enabled.

0 Kudos
MobiusSnake
MVP Regular Contributor

I don't have an explanation, but maybe something to try.  If you're currently using deleteFeatures() or editFeatures() in the API, see whether it still happens if you switch to FeatureLayerManager.truncate().

0 Kudos
mpboyle
Frequent Contributor

I was aware of the truncate method within the FeatureLayerManager and was hesitant to use it due to its restrictions, outlined here. However, I did change one of our scripts to use this rather than FeatureLayer.delete_features to see if it provided any change. And...it seems to have done the job!

I made the change to this script around 11:30AM, and by about 1PM the feature layer showed a substantial reduction in item size, see first graph below. The item size looks to have remained consistent since making the change to use FeatureLayerManager.truncate.

In the second graph below is one of our hosted feature layers that's still using FeatureLayer.delete_features. You can see this feature layer continues to grow in item size.

I won't speculate on what's being done behind the scenes by Esri, but it does seem that using the truncate method flushes/resets/removes something that the delete_features method is not.

 

Example 1: Hosted feature layer changed to using FeatureLayerManager.truncate at around 11:30AM on 12/8/2025. Substantial drop in item size noticed around 1PM and item size looks to remain consistent.

mpboyle_0-1765291293636.png

 

Example 2: Hosted feature layer still using FeatureLayer.delete_features and the item size continues to grow.

mpboyle_1-1765291434915.png

 

 

MichaelVolz
Esteemed Contributor

From my experience with on-prem data in file gdbs and enterprise gdbs, Truncate is much better than Delete_Features as it seems to keep data compressed.  I tried to update a fairly large line feature class using Delete_Features every 5 minutes and after a few days the feature class slowed to a crawl.  Once I applied the Truncate method, the performance stayed consistent as well as the file size.

0 Kudos
mpboyle
Frequent Contributor

Yea, when we're doing anything with internal datasets (ex: file gdb or enterprise gdb), we use truncate over deleting features. Makes sense to use it with feature layers too.

0 Kudos
MichaelVolz
Esteemed Contributor

So based on this behavior, when would anyone not want to use Truncate instead of Delete_Features?

0 Kudos
mpboyle
Frequent Contributor

I can see scenarios where you may just want to delete certain features using a where clause. For example, we have a hosted feature layer that stores point-in-time data and has data written to it every 5 minutes. Once the data is written, it's not going to change, so there's not really a point in deleting all rows and replacing them. However, at some point we do want to trim the data within the feature layer, so we use delete_features to delete those feature older than a certain date. The graph below shows the item size for thisparticular feature layer. It's still growing over time, but at a much slower rate...possibly (likely?) because we aren't removing ALL features when it's updated, but rather deleting features once a day based on the date value.

If you're going to be replacing ALL features within a hosted feature layer, I think this makes the case to use truncate over delete_features.

 

mpboyle_0-1765299623565.png

 

0 Kudos
troyf_PTC
Emerging Contributor

I know in my case (rural utility telecom), we started out truncating everything every night. But it had an impact on offline workflows and speed/efficiency for offline map syncing for our users, since it essentially deleted and re-populated the entire layers with the new GlobalIDs. And some things we just need creation and editor tracking and things like that, which get reset when the feature is re-created. And God forbid that a user made offline edits and didn't sync it before EoD. So for me it's always a balancing act between maintenance cost (ie: credit usage and performance and time spent on data administration) vs the stakeholder user experience, especially the mobile workers (utility locators, construction crews, field technicians) which tend to get frustrated easily.

0 Kudos