Skip to content

Respect limit argument for PostgreSQL queries #57589

@armenzg

Description

@armenzg

I've been investigating slow queries for issues and issues-count. I've noticed that even though we use a limit of 10 and 100 respectively, these are not respected.

For instance, if you load this issue you will see limit 3001 in the message. If you click "Show More" you will that the variable limit says 100.

This code is called with a limit of 3001 (1) regardless of what value is passed to limit to the function.

Here are some of the queries that would benefit from this (possibly more): 1, 2, 3 and 4

I expect some of the issues in here to improve:
image

Change

  • Create branch to use [: limit + 1] instead of [: max_candidates + 1] using a feature flag
  • Meet with ops on how we will track the overall improvement of the PostgreSQL hosts (they may just give us a link)
  • Create a DD dog and show the timing for queries using one approach and the other one
  • Use set_tag in order to track errors that are specific to this change

NOTE: This change could have a high impact on the product behaviour, thus, we need to go out slowly

Rollout

  1. Enable change for Sentry
  2. Review there are no new errors, average and p99 has improved
  3. Communicate with Doordash and enable for them
  4. Review there are no new errors, average and p99 has improved
  5. Create option set to 0 and enable for EA orgs
  6. Increase option to 5% of EA orgs, no new issues and review metrics
  7. Increase option to 100% of EA orgs, no new issues and review metrics
  8. All EA orgs do not use option, set option to 0, GA orgs pay attention to option
  9. Increase option to 5% of GA orgs, no new issues and review metrics
  10. Increase option to 100% of GA orgs, no new issues and review metrics

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions