Fetching records is slow.

Open
#221 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
mongodb, python

Research direction

The slow path is the retrieve_docdb_records method, which pages through results with skip and limit; start by reading how it builds its MongoDB query and projection. The issue proposes cursor-based pagination on the created and id fields, possibly with a compound index, but the approach is not settled, so confirm the design with maintainers before coding. Done means large fetches with a projection run measurably faster and existing tests still pass.

Written by the indexing model from the issue text.

Description

Is your feature request related to a problem? Please describe.
It takes several minutes to fetch a large batch of records even with a projection enabled.

Describe the solution you'd like
Currently, the retrieve_docdb_records method uses skip and limit to perform pagination. We can probably get better performance by switching to a cursor based pagination query. We may need to add a compound index using the created and id fields.

Describe alternatives you've considered
Keep things as they are.

Additional context
Add any other context or screenshots about the feature request here.

Dominant language
Python
Stars
3
Forks
0
Avg merge
2d 14h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AllenNeuralDynamics/aind-data-access-api

All issues in AllenNeuralDynamics/aind-data-access-api

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.