Skip to content

Add smart_proxy_id index to smart_proxy_features#10994

Open
pablomh wants to merge 1 commit into
theforeman:developfrom
pablomh:fix/add-smart-proxy-features-index
Open

Add smart_proxy_id index to smart_proxy_features#10994
pablomh wants to merge 1 commit into
theforeman:developfrom
pablomh:fix/add-smart-proxy-features-index

Conversation

@pablomh
Copy link
Copy Markdown
Contributor

@pablomh pablomh commented May 21, 2026

Summary

Add smart_proxy_id index to smart_proxy_features.

Problem

smart_proxy_features has no index besides the primary key. At high concurrency, proxy feature lookups generate sequential scans on every request.

On small deployments (1 proxy, 5 rows), PostgreSQL's planner prefers seq scan regardless — the index has no measurable impact. On larger deployments with 50-100 proxies (250-500 rows), the index becomes relevant as the planner switches to index lookups.

Found via pg_stat_user_tables during registration performance testing at 1368 concurrent registrations.

Test plan

  • Migration runs without errors
  • No regression on small deployments (planner ignores the index on tiny tables)
  • pg_stat_user_tables shows idx_scan usage on deployments with many proxies

smart_proxy_features is queried on every request for proxy feature
lookups but has no index besides the PK. At 912+ concurrent
registrations, this generates 183K sequential scans (100% seq scan
rate) at ~19ms avg under contention.

Found via pg_stat_user_tables during registration performance testing
with SQL debug logging enabled.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant