Skip to content

Conversation

@labkey-nicka
Copy link
Contributor

@labkey-nicka labkey-nicka commented Oct 7, 2025

Rationale

This addresses Issue 53997 by establishing a maximum query selection size of (M=100,000). Some things to note:

API Changes

  1. The query-selectAll.api will now select up to the first M rows. If the underlying query contains more rows than the maximum, then the first M will be selected. If the underlying query contains less than M rows, then all rows will be selected.
  2. The query-setSelection.api (named QueryController.SetCheckAction) will reject any selection that will result in a selection size over the maximum. When rejected the pre-existing selection will remain unchanged.

UI Changes

  1. In the event that an application grid or a LKS data region is displaying a grid with more than M rows, then the "Select All" button will instead display "Select First M Rows".
  2. If a user manually selects more than the maximum amount, then an error will be displayed inline in either the application grid or LKS data region.

Related Pull Requests

Changes

  • Refactor selections to consistently make use of LinkedHashSet making comparison/iteration operations much faster. Formerly, we were converting between different structures which resulted in a lot more time composing/iterating (e.g., clearing a selection where the selection size is very large).
  • Update client-side data region to render Select First M Rows button when applicable.
  • Display error message in data region if selection is greater than M.
  • Declare constant maximum selection size on server. Pass to client via module context property.

Copy link
Contributor

@labkey-jeckels labkey-jeckels left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm misreading the code or expected behavior, but it seems like this won't be true if there are any existing rows selected that aren't in the first M rows:

The query-selectAll.api will now select up to the first M rows

I think createSelectionSet() will return 100,000 entries, which will then be rejected when merged with the existing selection in setSelected().

Maybe that's fine, but it's a more muddled of a behavior to describe.

values = StringUtils.split(values[0],'\t');
List<String> parameterSelected = values == null ? new ArrayList<>() : Arrays.asList(values);
Set<String> result = new LinkedHashSet<>(parameterSelected);
Set<String> result = values == null ? new LinkedHashSet<>() : new LinkedHashSet<>(Arrays.asList(values));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LinkedHashSet uses significantly more memory than ArrayList.

Copy link
Contributor Author

@labkey-nicka labkey-nicka Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood but the ArrayList here was just interstitial. Mainly looking to go from a String[] to a LinkedHashSet as quickly as possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, the change here to stop converting to lists is significantly more performant since we end up doing set logic on these and conversions between the same types is much faster. Saw a significant reduction in processing time switching everything to using the same set structure (e.g., "Clear all" selection).

@labkey-nicka labkey-nicka force-pushed the fb_max_selection_53997 branch from 1be74a6 to 4715dd7 Compare October 10, 2025 03:14
@labkey-nicka labkey-nicka merged commit d06406c into develop Oct 10, 2025
6 of 13 checks passed
@labkey-nicka labkey-nicka deleted the fb_max_selection_53997 branch October 10, 2025 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants