Skip to content

Conversation

jnovinger
Copy link
Member

Fixes: #20023

Resolves performance issue where prefix deletion with 2000+ children took 5-10 minutes due to sequential scans in hierarchy depth/children calculations. Adding PostgreSQL GiST index with inet_ops enables efficient network containment operators (>>, <<, <<=) in annotate_hierarchy() queries.

Performance impact:

  • 30-60x speedup: 5-10 minutes → 10 seconds for large prefix deletions
  • Real-world validation: 4s migration time on 1.24M prefix dataset
  • Storage cost: 47MB index (11% of table storage, 38 bytes per prefix)

Works in conjunction with existing B-tree indexes on vrf_id for optimal query performance. Benefits all network containment operations including hierarchy navigation, aggregate views, and available IP/prefix calculations.

Resolves performance issue where prefix deletion with 2000+ children
took 5-10 minutes due to sequential scans in hierarchy depth/children
calculations. Adding PostgreSQL GiST index with inet_ops enables efficient
network containment operators (>>, <<, <<=) in annotate_hierarchy() queries.

Performance impact:
- 30-60x speedup: 5-10 minutes → 10 seconds for large prefix deletions
- Real-world validation: 4s migration time on 1.24M prefix dataset
- Storage cost: 47MB index (11% of table storage, 38 bytes per prefix)

Works in conjunction with existing B-tree indexes on vrf_id for optimal
query performance. Benefits all network containment operations including
hierarchy navigation, aggregate views, and available IP/prefix calculations.
@jnovinger jnovinger requested review from a team and bctiemann and removed request for a team August 8, 2025 18:59
@jnovinger jnovinger merged commit 8bb47da into main Aug 8, 2025
10 checks passed
@jnovinger jnovinger deleted the 20023-slow-prefix-deletion branch August 8, 2025 19:15
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting prefixes with large number of children (Performance)
2 participants