ifixkart-admin/docs/database/scaling.md
Adithiyan bbd3a3e959 feat: initial commit — full platform snapshot
- Backend: FastAPI app with all models, services, schemas, routes
- Admin Panel: Next.js dashboard with all modules
  (CRM, POS, repairs, warranties, billing, notifications, etc.)
- Ecommerce: storefront (submodule) + product catalog
- AI Agents: .agents/ skill library for Antigravity IDE
- Docs: architecture, billing, notification gateway markdown
- Submodules: Backend/OpenWA, Ecommerce/File 2/storefront
2026-10-13 12:59:47 +05:30

26 lines
773 B
Markdown

# Database Scaling Strategy
## Sharding & Partitioning Roadmap
---
## 1. Table Partitioning (Stage 3)
Historical tables (`orders`, `inventory_ledger`, `outbox_events`) enforce MySQL `RANGE` partitioning by year/month:
```sql
ALTER TABLE orders PARTITION BY RANGE (YEAR(created_at)) (
PARTITION p2025 VALUES LESS THAN (2026),
PARTITION p2026 VALUES LESS THAN (2027),
PARTITION p2027 VALUES LESS THAN (2028),
PARTITION pmax VALUES LESS THAN MAXVALUE
);
```
---
## 2. Horizontal Sharding Evaluation (Stage 4)
If catalog or order traffic exceeds single-cluster limits:
* **Vitess Integration**: Vitess proxy handles distributed query routing over multiple MySQL shards.
* **Shard Keys**: `customer_id` for orders/carts; `category_id` for catalog items.