Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix getIdentities route slowdown #134

Merged
merged 5 commits into from
May 14, 2024
Merged

Fix getIdentities route slowdown #134

merged 5 commits into from
May 14, 2024

Conversation

pshenmic
Copy link
Owner

@pshenmic pshenmic commented May 14, 2024

Issue

API route path /identities shows performance degradation when there are a lot of documents in the database

image

The reason is that counting of documents contains a ranking window function that applies N (page size) times on the whole documents set and gets filtered afterwards. This query should first filter documents by identity and then apply ranking function.

Things done

  • Optimised counting of documents in the getIdentities SQL query (filter-first)
  • Added additional SQL index for window sorting
  • Removed unused document_identifier index

@pshenmic pshenmic added the backend Related to backend (API) label May 14, 2024
@pshenmic pshenmic self-assigned this May 14, 2024
Copy link

vercel bot commented May 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
platform-explorer-zham ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2024 8:57pm

@pshenmic pshenmic merged commit b5c3fdc into master May 14, 2024
7 checks passed
@pshenmic pshenmic deleted the perf/get-identities branch May 14, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Related to backend (API)
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant