Skip to content

GitHub Issue #1607: Return selectRows total count without the rows query - #8101

Merged
cnathe merged 7 commits into
release26.7-SNAPSHOTfrom
26.7_fb_totalRowCount1607
Sep 30, 2026
Merged

cnathe merged 7 commits into
release26.7-SNAPSHOTfrom
26.7_fb_totalRowCount1607

Conversation

@cnathe

@cnathe cnathe commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

https://github.com/LabKey/internal-issues/issues/1607

In the app React grid, we are sending two API requests: one for the page of data and a second for the total row count. Because the total row count API call sends maxRows: 1, we are getting an extra LIMIT 2 query on the server side prior to the COUNT(*) query.

selectRows with maxRows=0 and an explicitly sent includeTotalCount=true now becomes a count-only request. The server runs only COUNT(*) (skipping the LIMIT 2 rows query) and returns rowCount, an empty rows list, and metadata only if asked for. loadTotalCount in withQueryModels now sends maxRows: 0 and includeMetadata: false.

Related Pull Requests

Changes

  • SelectRowsAction treats maxRows=0 with an explicit includeTotalCount=true as a count-only request
  • a new count-only path runs only the COUNT(*) and returns rowCount, metadata if requested
  • adds loadTotalRowsOnly(), which checks read permission and runs COUNT(*) without a rows query
  • getAggregates() no longer returns empty when no rows query has run

Comment thread api/src/org/labkey/api/data/DataRegion.java Outdated
… QC warning's all-results query

- A count-only request (maxRows=0) sets showRows to NONE, so setMaxRows(ALL_ROWS) hit the "Can't set maxRows when not paginated" assertion.
cnathe added a commit to LabKey/labkey-ui-components that referenced this pull request Sep 30, 2026
…ery (#2081)

#### Rationale
LabKey/internal-issues#1607
See platform PR for rationale

#### Related Pull Requests
- LabKey/platform#8101
- #2081
- LabKey/limsModules#2501
- LabKey/testAutomation#3215

#### Changes
- withQueryModels.tsx update to reduce server side queries with the
combination of maxRows 0 and includeTotalCount true
@cnathe
cnathe merged commit 8daf7c1 into release26.7-SNAPSHOT Sep 30, 2026
10 checks passed
@cnathe
cnathe deleted the 26.7_fb_totalRowCount1607 branch September 30, 2026 14:22
cnathe added a commit to LabKey/testAutomation that referenced this pull request Sep 30, 2026
…ery (#3215)

## Rationale
LabKey/internal-issues#1607
See platform PR for rationale

## Related Pull Requests
- LabKey/platform#8101
- LabKey/labkey-ui-components#2081
- LabKey/limsModules#2501
- #3215

## Changes
- Test selectRows count-only requests
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.

2 participants