Skip to content

ATLAS-5194: Add pagination while fetching relationships of an entity#510

Open
sheetalshah1007 wants to merge 1 commit intoapache:masterfrom
sheetalshah1007:ATLAS-5194
Open

ATLAS-5194: Add pagination while fetching relationships of an entity#510
sheetalshah1007 wants to merge 1 commit intoapache:masterfrom
sheetalshah1007:ATLAS-5194

Conversation

@sheetalshah1007
Copy link
Contributor

@sheetalshah1007 sheetalshah1007 commented Jan 30, 2026

What changes were proposed in this pull request?

Introduces searchRelatedEntitiesV2 with graph-layer pagination support, achieving a significant performance improvement for large datasets and deep pagination scenarios (offset > 1000). The new method selects between database-level pagination (for unsorted queries) and traditional Gremlin traversal (for sorted queries), while maintaining full backward compatibility with the existing searchRelatedEntities method

Why It Was Needed?

The earlier searchRelatedEntities implementation applies default sorting by the name attribute in ascending order when no sort criteria are provided. This requires loading all related entities into memory before sorting and pagination can be applied. As a result, queries involving a large number of relationships or high offset values suffer from significant performance degradation, leading to long response times and, in some cases, timeouts.

How was this patch tested?

Performance validation was conducted on test databases with 100, 1K, 10K, and 50K entities(relationships), measuring server-side execution time from audit logs across multiple manual test scenarios.
• No regression for sorted queries

* @throws AtlasBaseException
*/
@GET
@Path("relationship/v2")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please review if there is need to introduce new API

*/
@GraphTransaction
@Override
public AtlasSearchResult searchRelatedEntitiesV2(String guid, String relation, boolean getApproximateCount, SearchParameters searchParameters, boolean disableDefaultSorting) throws AtlasBaseException {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please incorporate changes in the existing method, to avoid code duplication

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.

3 participants