🔍 In DataGrip (or pgAdmin, MySQL Workbench, etc.)
When you’re using partitioning, you typically see:
- The main table (logical parent)
- Its child tables (actual partitions)
Example (PostgreSQL):
In your table list, you’ll see:
📁 Tables
├── sales -- 👈 Parent table
├── sales_2023_q1 -- 👶 Partition
├── sales_2023_q2 -- 👶 Partition
- You query the parent table (
sales) - The data is stored in the partition tables (
sales_2023_q1, etc.) - Each partition can be opened individually, showing its subset of data
🧠 What’s Actually Happening
- The parent table is empty by itself (in most partitioning implementations)
- When you
SELECT * FROM sales, the DB internally runs:
SELECT * FROM sales_2023_q1
UNION ALL
SELECT * FROM sales_2023_q2
...
If partition pruning applies, only the relevant partition(s) are queried.
🧰 Database-Specific Behavior
| Database | Partition Table Appearance in Tools |
|---|---|
| PostgreSQL | Shows parent + child tables (visible) |
| MySQL (InnoDB) | Shows only 1 logical table (partitions hidden) |
| Oracle | Partitions may not show as separate tables |
| SQL Server | Partitioning done via partition schemes (not separate tables) |
✅ Summary
| What You See in DataGrip | Notes |
|---|---|
| Parent table | The table you query directly |
| Child/partition tables (PostgreSQL) | Can be viewed, queried directly |
| One unified table (MySQL) | Partitioning happens under the hood |