Load All Data in Repeating Group or Not

Hello,

I have a question regarding performance and WU consumption.

I have an application where I provide multiple lessons for students to watch.
Whenever a student clicks on a lesson, I confirm that they have watched it.
This results in a very large table.
I currently have around 1,000 lessons.
So, over time, each student will have 1,000 rows created in the database.

Now, here is the situation:

I need to use the watched lessons data for each student who enters the application for several purposes, such as calculating the number of lessons watched, calculating the total hours watched, marking the watched lessons in green, among other actions.

Theoretically, I would need to perform multiple Do a Search For queries.

To avoid running Do a Search For multiple times, I set up a Repeating Group to load all the watched lesson records at once. Now, all the actions that need to check which lessons a student has watched refer to this Repeating Group, instead of performing a new Do a Search For each time.

Is this a good practice to reduce WU consumption and improve performance?
Or would it be better to allow multiple Do a Search For queries instead?

Note: I am already using Privacy Rules to restrict lessons per student.

Thanks in advance for your help!

Best regards,

From what i’ve learnt so far, refering to groups or RG with data is much more efficient than using searches.

Also, curious why not have only one table, for lessons and then a field like, “students_watched” which a student gets added to when they watch

1 Like

largely depends

for aggregates it’s usually better to just do separate “seach:count” for each aggregate

if you reference 1 repeating group for the aggregates then the entire list has to be downloaded to the page to count it

if you use “search:count” then only the number is sent to the page and nothing else

count a list of 10k things = slow load and slow count appearing
count a list of 100 things = fine

the solution depends on how long you think the list will be. I’d lean towards doing aggregates searches instead of repeating group counts in general but there’s no one size fits all

Maybe set state on page load and use those states with filters to show within the RG?