Online Schema & Shard Changes User Guide
Online Schema & Shard Changes User Guide
Overview
Modify sharding keys, add shards, or change distribution strategies without downtime using zero-copy shard splits and online schema changes.
Benefits
- Zero downtime
- No application changes
- Automatic data migration
- Rollback support
Prerequisites
- HeliosDB v3.2+ cluster
- Sufficient capacity for temp data
- Metadata service online
Configuration
online_changes: enabled: true max_migration_bandwidth_mbps: 200 validation_mode: strict rollback_on_error: trueSQL Examples
Change Shard Key
-- Change shard key onlineALTER TABLE orders RESHARD BY user_id; -- Was order_id
-- Progress monitoringSELECT phase, -- preparing, migrating, validating, finalizing progress_percent, estimated_completionFROM heliosdb.online_change_statusWHERE table_name = 'orders';Add Shard
-- Add shard to existing sharded tableALTER TABLE large_table ADD SHARD ON 'node-4';
-- Automatic rebalancingSplit Shard
-- Zero-copy splitSELECT heliosdb.split_shard( 'large_table', shard_id => 1, split_keys => ARRAY[1000000]);Migration Phases
- Preparing: Create shadow structures
- Migrating: Copy data (online, non-blocking)
- Validating: Verify integrity
- Finalizing: Atomic switch
Best Practices
- Test on staging first
- Schedule during low traffic
- Monitor progress closely
- Have rollback plan
- Validate after completion
For more: /docs/operations/online-changes.md