Skip to content

perf(records): faster autodelete candidate query#6150

Merged
TBonnin merged 1 commit into
masterfrom
tbonnin/nan-5089/record-counts-last-autodelete-checked-at
May 14, 2026
Merged

perf(records): faster autodelete candidate query#6150
TBonnin merged 1 commit into
masterfrom
tbonnin/nan-5089/record-counts-last-autodelete-checked-at

Conversation

@TBonnin

@TBonnin TBonnin commented May 14, 2026

Copy link
Copy Markdown
Collaborator

The query to select candidates for records autodeletion is inefficient and require pg to scan the record_counts table.
It is also inefficient because randomly picking a entry can potentially return entries that have already been checked recently. This commit adds a autodelete_checked_at column (with index) to the record_counts table so the query can quickly select the least recently checked entry

@TBonnin TBonnin requested a review from a team May 14, 2026 13:36
@linear

linear Bot commented May 14, 2026

Copy link
Copy Markdown

NAN-5089

@superagent-security superagent-security Bot added contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis. and removed contributor:verified Contributor passed trust analysis. labels May 14, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 35af2cc6ce

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

cubic-dev-ai[bot]

This comment was marked as off-topic.

@TBonnin TBonnin force-pushed the tbonnin/nan-5089/record-counts-last-autodelete-checked-at branch from 35af2cc to 5322447 Compare May 14, 2026 13:47
@superagent-security superagent-security Bot added the contributor:verified Contributor passed trust analysis. label May 14, 2026
The query to select candidates for records autodeletion is inefficient
and require pg to scan the record_counts table.
It is also inefficient because randomly picking a entry can potentially
return entries that have already been checked recently.
This commit adds a autodelete_checked_at column (with index) to the record_counts
table so the query can quickly select the least recently checked entry
@TBonnin TBonnin force-pushed the tbonnin/nan-5089/record-counts-last-autodelete-checked-at branch from 5322447 to f9789cd Compare May 14, 2026 14:12
@NangoHQ NangoHQ deleted a comment from chatgpt-codex-connector Bot May 14, 2026
@TBonnin TBonnin added this pull request to the merge queue May 14, 2026
Merged via the queue into master with commit 4fdd881 May 14, 2026
26 checks passed
@TBonnin TBonnin deleted the tbonnin/nan-5089/record-counts-last-autodelete-checked-at branch May 14, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor:verified Contributor passed trust analysis. pr:verified PR passed security analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants