fix docs
This commit is contained in:
@@ -338,6 +338,33 @@ CREATE TABLE rawdatacor_2024 PARTITION OF rawdatacor
|
||||
|
||||
PostgreSQL automatically routes INSERTs to the correct partition based on `event_year`.
|
||||
|
||||
### Indexes in PostgreSQL
|
||||
|
||||
Both tables have these indexes automatically created:
|
||||
|
||||
**Primary Key** (required for partitioned tables):
|
||||
```sql
|
||||
-- Must include partition key (event_year)
|
||||
UNIQUE (id, event_year)
|
||||
```
|
||||
|
||||
**Consolidation Key** (prevents duplicates):
|
||||
```sql
|
||||
-- Ensures one record per consolidation group
|
||||
UNIQUE (unit_name, tool_name_id, event_timestamp, event_year)
|
||||
```
|
||||
|
||||
**Query Optimization**:
|
||||
```sql
|
||||
-- Fast filtering by unit/tool
|
||||
(unit_name, tool_name_id)
|
||||
|
||||
-- JSONB queries with GIN index
|
||||
GIN (measurements)
|
||||
```
|
||||
|
||||
**Note**: All indexes are automatically created on all partitions when you run `setup --create-schema`.
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
Reference in New Issue
Block a user