Size Limit to List Fields - Best Practice?

I have a field called “Audit Trail” that is in the User Data Type. It’s a list of text.

This field has hundreds, sometimes thousands, of entries.

I only want to display the top 5 entries, and then have pagination/search for the rest.

I believe the best way to structure this is to have the “Audit Trail” Data Type, and add a field “User” that links back to the User table.

However, I think both methods consume a significant amount of workload units if I only want to display the top 5 most recent on that User’s profile page.

I’m either doing a search through all of the “Audit Trails” for all users to return a small set

OR

I’m pulling a massive list for a single user and filtering it down to their 5 most recent

Can someone tell me which one is more optimal for WU?

1 Like

The most workload-efficient approach is to store Audit Trail as a separate data type linked to the User.

Lists of text on the User are expensive because Bubble loads the entire list before slicing it, even if you only display 5 items. That means WU is consumed for all entries, not just the ones shown.

With a dedicated Audit Trail data type, Bubble only retrieves exactly what you ask for (e.g. the 5 most recent records sorted by Created Date), which is significantly cheaper in WU and scales much better as the audit log grows.

This structure also enables highly optimized pagination and search, where each page only loads a small subset of records instead of a massive list.

If helpful, I can walk you through setting up pagination in a way that minimizes workload usage even with thousands or millions of audit records.

Hi, You can use this feature in your Search for:items until #n, which will cause Bubble to display only the first “n” customers found in the search.

image

1 Like

Having an Audit Trail data type is the correct approach and returning only the five most recent results will only charge you WU for the five returned results :slight_smile:

Thank you everyone for your help with this! Appreciate it, I didn’t realize the search until only returned those items in the data set, so that helps immensely.