Skip to content

[draft] Feature Request: Add Index Migration Support for Syncs #3721

@cryptus-neoxys

Description

@cryptus-neoxys

Problem Statement

Currently, PeerDB syncs focus on data replication but don't handle index migration from source to target databases. This creates manual overhead for users who need to recreate indexes on the target system.

Proposed Solution

Add automatic index migration support during sync operations:

Key Features:

  • Detect and capture index definitions from source database
  • Replicate indexes to target database during initial sync
  • Support common index types (B-tree, Hash, GiST, GIN, etc.)
  • Handle index creation timing (post-data load for performance)
  • Provide configuration options to include/exclude specific indexes

Benefits:

  • Reduces manual setup time
  • Ensures query performance parity between source and target
  • Minimizes risk of missing critical indexes
  • Improves overall sync completeness

Implementation Considerations

  • Index creation should occur after initial data load to optimize performance
  • Support for partial indexes and expression-based indexes
  • Handle index naming conflicts
  • Provide dry-run mode to preview index migration plan
  • Add metrics for index creation progress

Use Cases

  • Production to staging environment replication
  • Database migration projects
  • Read replica setup with full schema parity
  • Disaster recovery scenarios

Would appreciate feedback on this proposal and any additional requirements to consider.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions