Skip to content
Snippets Groups Projects

codeintel: Optimize UpdateDependencyNumReferences query

Merged Warren Gifford requested to merge ef/optimize-update-dependency-num-references into main

Created by: efritz

This query should do the same thing but should choose a much better query plan. This should take some pressure off of Postgres as the previous query is inefficient enough to create some LSIF processing back pressure, which we generally don't encounter.

Two changes help here:

  • We add a materialized cte around a select of a table to better hint at a more efficient index
  • Use UPDATE FROM instead of a subselect, which kept scanning CTE results

I've been trying a few queries on the Cloud database and I've taken some samples down from minutes to sub-second with these changes.

Merge request reports

Merged by avatar (Jun 8, 2025 1:16pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading