Skip to content

[dataquery] /dictionary/categories load time scales with the number of visit labels #11166

Description

@HenriRabalais

Describe the bug

The Data Query Tool's dictionary endpoints (/dictionary/categories and /dictionary/module/<name>) become very slow on databases with many visit labels. On an instance with ~32k candidates, ~66k flag rows and 172 distinct visit labels, /dictionary/categories takes ~72 seconds to respond, and the tool sits on "Loading…" the whole time before the welcome screen appears.

To Reproduce

  1. Use a database with a large number of distinct session.Visit_label values.
  2. Log in and open the Data Query Tool.
  3. Observe that the initial load blocks on GET /dictionary/categories for a long time.

Expected behavior

The dictionary endpoints should return in roughly constant time regardless of the number of visit labels. Fetching the accessible instruments in a single query over all of the user's visits brings /dictionary/categories down from ~72s to ~2s on the same instance, with byte-for-byte identical output.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions