Creating Dimension Tables
Introduction: From Raw Data to Analytics-Ready Models
Now that you have learned how to connect Amazon Redshift Serverless to your S3 data lake and run queries using Redshift Spectrum, you are ready to take the next step in building a modern analytics warehouse. In this lesson, you will move beyond querying raw data and start organizing it for analytics by creating dimension tables inside Redshift. This is a key part of modeling your data for fast, flexible analysis. By the end of this lesson, you will know how to use Python and the boto3 library to create dimension tables in Redshift, setting the foundation for a star schema that supports business intelligence and reporting.
Spectrum vs. Loading Data into Redshift: When to Use Each
Before we dive into modeling, let’s clarify a key design decision: Should you keep querying data in S3 with Spectrum, or should you load it into Redshift tables? Each approach has its strengths and trade-offs. Here’s a quick comparison to help you choose the right tool for the job:
| Approach | Latency | Performance | Cost | Joins | When to Use |
|---|---|---|---|---|---|
| Spectrum (S3 external) | Higher | Slower for complex | Pay per query/data | Limited (external→internal joins slow) | Ad hoc, raw/large data, infrequent |
| Internal Redshift table | Lower | Fastest, optimized | Storage + compute | Full support, fast | Frequent queries, reporting, joins |
Guidance:
Use Spectrum for ad hoc or infrequent analysis on large, raw, or rarely accessed data in S3.
Load data into Redshift tables for frequent, complex, or join-heavy analytics, especially when powering dashboards or BI reports.
- Latency: Spectrum queries have higher startup time since data is read from S3. Internal tables are always ready for fast access.
- Performance: Internal tables are optimized for analytics (sort keys, distribution, indexes). Spectrum is great for quick exploration, but can be slow for large joins or aggregations.
- Cost: Spectrum charges per amount of data scanned. Internal tables incur storage and compute costs, but are more cost-effective for repeated queries.
- Joins: Joining external (S3) and internal (Redshift) tables is possible, but much slower than joining internal tables only.
