Explain the concept of data partitioning and how it impacts query performance.
Demonstrate the explanation with a PostgreSQL query that retrieves project costs for the first quarter of 2025. The date predicate should allow a range-partitioned cost table to exclude irrelevant partitions.
office_name, total_costtotal_cost descending, then office_name ascending with null office names last| Column | Type | Description |
|---|---|---|
| cost_idPK | INT | Unique cost record identifier |
| office_id | INT | Office associated with the cost |
| cost_date | DATE | Cost date and range-partitioning key |
| amount | DECIMAL(12,2) | Recorded project cost |
| Column | Type | Description |
|---|---|---|
| office_idPK | INT | Unique office identifier |
| office_name | VARCHAR(100) | Display name of the office |
| region | VARCHAR(50) | Geographic region |