matrixorigin / matrixorigin/matrixone
[Feature Request]: Enhanced AUTO_INCREMENT Support
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Is there an existing issue for the same feature request?
- [x] I have checked the existing issues.
## Is your feature request related to a problem?
Yes, currently MatrixOne has limitations with AUTO_INCREMENT:
1. **Cannot modify AUTO_INCREMENT starting value after table creation**
2. **Limited control over cache behavior**
3. **Duplicate key errors with manual inserts**
## Describe the feature you'd like
### 1. ALTER TABLE AUTO_INCREMENT Support
```sql
ALTER TABLE table_name AUTO_INCREMENT = 1000;
```
### 2. AUTO_ID_CACHE Table Option
```sql
CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY) AUTO_ID_CACHE = 100;
```
### 3. Session Variables
```sql
SET @@auto_increment_increment = 2;
SET @@auto_increment_offset = 1;
```
## Implementation Considered
1. Distributed Counter Management
2. Metadata Storage
3. Session Variable Support
4. Backward Compatibility
## Use Cases
- Data Migration
- System ID Reservation
- Performance Tuning
## Additional information
**References**: https://docs.pingcap.com/tidb/stable/auto-increment
**Priority**: High
Contributor guide
Assessment
This issue has not been assessed yet.