How many records you assume to be selected in one go?
I doubt it would create performance issues or system crash in this scenario. Maybe try testing with full load and see if the performance is desirable or not.
Otherwise one solution could be to create another entity SelectionHelper. Now in datagrid you can place a button to add records into current selection. This button will retrieve first SelectionHelper entity object and associate it with the list of selected records. (Create an association between SelectionHelper and your other entity)
Now you can access your selected records list from a single reference of SelectionHelper.
When you want to process the records, you can do it in batches by retrieving your desired amount of selected records. At the end you may delete the helper object.
In a datagrid there is no default option to maximize the number of objects selected. However if you use a microflow for this selection you can build this logic yourself by:
The problem is probably with your datasource microflow for the datagrid to begin with. With a MF datasource, as a result all the objects returned by the microflow are passed on to the client and not only the items which are shown (ie. 1-20 of 5000). This could already cause your performance problems. You should find a way model this differently, like limit the retrieve with a custom setting or use a Xpath contraint on the datagrid as to limit the objects send to the client.
Example below is for two different requests:
first XAS request is a DB source datagrid with 20 rows with database source:
Second XAS request is for MF Source Datagrid with 20 rows with a custom limit of 5000 on the retrieve in the microflow:
As you can see with a microflow source datagrid all object retrieved in the microflow are sent to the client.