Ravindra BagaleCourses & study guides मराठी Track your progress

What Is Amazon Redshift? Data Warehouse on AWS Explained

Your app database (RDS/DynamoDB) answers single-customer lookups fast. The CFO asks for last year sales by city and product — that is analytics. Amazon Redshift is AWS cloud data warehouse: columnar storage, massively parallel queries, great at scanning large fact tables.

What you'll learn in this chapter

  • Why warehouses differ from OLTP
  • What Redshift clusters / Serverless / Spectrum are
  • How data lands with COPY and distribution styles
  • Industries using Redshift
  • Lab, errors, FAQ, interview

1. Everyday example first

A Surat textile marketplace dumps daily order Parquet into S3. A Glue job lands cleaned facts; Redshift COPY or Spectrum queries power Metabase dashboards for sellers. RDS MySQL stays for checkout — not for last-365-days GROUP BY.

2. Why Redshift?

Why do we need this?

Row stores excel at transactions. Columnar warehouses compress and scan only needed columns for BI. Redshift adds MPP parallelism and AWS integrations (S3, IAM, Spectrum).

  • Fast aggregations on large history
  • Separate analytics load from OLTP
  • Spectrum to query S3 without full ingest
  • RA3 / Serverless options for modern sizing

3. What is Amazon Redshift?

What is it?

Redshift is a managed PostgreSQL-compatible warehouse. Classic clusters use leaders and compute nodes; RA3 separates storage; Serverless measures RPU. Distribution styles (KEY, ALL, EVEN) and sort keys shape performance. COPY loads from S3 efficiently.

PiecePlain job
Leader nodePlan/coordinate queries
Compute nodesStore data and run slices
RA3Managed storage; scale compute separately
ServerlessAuto capacity in RPUs
COPYBulk load from S3 (and friends)
SpectrumQuery external S3 tables
S3/OLTP exports → COPY/Spectrum → Redshift → BI toolsRaw facts
Dashboards & SQL analysts

4. How to load and model simply

How to do it (step by step)

  1. Keep OLTP for transactions; warehouse for analytics.
  2. Land Parquet/CSV in S3 with clear prefixes/dates.
  3. Create schemas/tables with distkey/sortkey thoughtfully (start EVEN + time sort).
  4. IAM role on Redshift to Read S3; COPY in parallel.
  5. Use Spectrum/external schemas for rarely used cold data.
  6. Vacuum/analyze as needed on provisioned; understand Serverless behaviors.
  7. WLM / concurrency scaling for bursty BI.
  8. Encrypt with KMS; restrict network (private).
  9. CI for SQL migrations; never hot-fix prod casually.
  10. Monitor STL/SVL tables for slow queries.
-- Mental COPY
-- COPY sales FROM 's3://bucket/facts/sales/'
-- IAM_ROLE 'arn:aws:iam::111122223333:role/RedshiftLoad'
-- FORMAT AS PARQUET;

5. Redshift vs RDS vs Athena

ChoiceWhen
RDS/AuroraOLTP app traffic
RedshiftRepeated BI on large curated warehouse
AthenaAd-hoc SQL on S3 lake; pay per query
Glue ETLTransform/catalog before warehouse

6. Multi-industry notes

Retail chains warehouse POS facts nightly. Insurers run actuarial SQL with concurrency scaling during month-end. Gaming studios analyze event aggregates without touching the live player DB.

7. Industries and roles

  • Retail/ecommerce analytics
  • Fintech ledgers & risk marts
  • Healthcare cohort reporting (with privacy controls)
  • AdTech click aggregates
  • Data engineers / analysts / BI developers

8. Lab: Serverless or tiny cluster + COPY mindset

Do this in ap-south-1 (Mumbai) unless your org forbids it. Set a budget alert first.

How to do it (step by step)

  1. Create Redshift Serverless workgroup (or tiny cluster if Serverless unavailable).
  2. Create IAM role for S3 read; associate to namespace/cluster.
  3. Upload a tiny CSV/Parquet sample to S3.
  4. CREATE TABLE then COPY; run a GROUP BY query.
  5. Optional: create external schema for Spectrum on the same prefix.

Cleanup (stop billing)

  1. Pause/delete Serverless workgroup or delete cluster; remove sample S3.
  2. Detach IAM roles you created only for lab.

9. Common errors and fixes

Each row is a real mistake students and juniors hit. Read the fix before you panic.

Error / symptomFix
Ran heavy reports on RDS and melted appMove analytics to warehouse/lake.
COPY without IAM roleAssociate role; trust redshift.amazonaws.com.
Wrong distkey causing redistribution stormsStart EVEN; evolve with evidence.
Selected * on huge fact dailyProject columns; aggregate early.
Publicly reachable warehousePrivate subnets + SG.
No compression/encoding awarenessLet COPY analyze or set encodings.
Spectrum over millions tiny filesCompact files; partition wisely.
Forgot vacuum on provisioned after mass deletesSchedule maintenance.
Shared superuser for all analystsRoles/groups least privilege.
Cost shock leaving cluster 24x7 idleRA3/Serverless/pause strategies.

10. Troubleshooting checklist

  1. COPY error: access denied S3 — role/bucket policy.
  2. Queue wait: WLM slots / concurrency.
  3. Slow join: skew on dist keys — check SVV.
  4. Disk full on dense nodes: archive/resize/RA3.
  5. SSL required failures: force encryption settings.
  6. Spectrum: Glue catalog permissions.

11. FAQ

Q. Postgres compatible?

SQL flavor similar; not every PG extension.

Q. Redshift vs Snowflake?

Both warehouses; evaluate lock-in/cost/skills.

Q. Serverless vs provisioned?

Variable vs steady workloads.

Q. Need ETL?

Usually yes — Glue/dbt/etc.

Q. Row-level security?

Features exist; design carefully.

Q. Backup?

Snapshots / recovery features — enable.

12. Interview Q&A

Q. What is Redshift?

AWS managed columnar MPP data warehouse.

Q. Columnar benefit?

Read only needed columns; better compression for BI.

Q. COPY?

Bulk parallel load typically from S3.

Q. Distkey?

How rows are placed across nodes to reduce reshuffle.

Q. Spectrum?

Query S3 external tables from Redshift.

Q. OLTP vs warehouse?

Transactions vs analytical scans.

13. Tips in English, Marathi and Hindi

Ravindra Bagale's Tip (EN)

Do not just point Metabase at RDS. Warehouses exist so checkout stays fast while finance scans history.

Ravindra Bagale's Tip (MR)

Metabase थेट RDS ला नका. Checkout जलद राहू द्या; finance warehouse स्कॅन करो.

Tip (HI)

Metabase सीधे RDS पर मत लगाओ — checkout तेज रहे, history warehouse स्कैन करे।

Try at home

  1. Write one query that belongs on RDS and one on Redshift.
  2. Explain KEY vs EVEN dist in two lines.
  3. List S3 landing folder naming for daily sales.

In short

  1. Redshift = analytics warehouse, not app OLTP.
  2. COPY/Spectrum from S3 are core patterns.
  3. Dist/sort keys and WLM shape speed.
  4. Keep it private and encrypted.

Revision, interview and comparison cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Revision card: What is Amazon Redshift?. OLTP databases choke on heavy analytic joins across years of facts. Redshift is a managed columnar data warehouse for BI and complex SQL at scale. Launch cluster or Serverless → COPY from S3 → model tables with DIST/SORT keys → connect BI. Nightly sales facts land via COPY; Looker dashboards query Redshift all day.
Revision card: What is Amazon Redshift? · Download PNG · Open card page
Revision card: DISTKEY and SORTKEY. Wrong distribution causes broadcast joins and slow scans. DISTKEY co-locates join keys across nodes; SORTKEY orders data for zone-map pruning on filters. DIST on common join key; SORT on frequent filter (date); ANALYZE after load. orders DIST customer_id SORT order_date cuts join+filter time sharply.
Revision card: DISTKEY and SORTKEY · Download PNG · Open card page
Comparison: Amazon Redshift vs Amazon Athena. Amazon Redshift: Managed warehouse; heavy joins/concurrency/BI. Amazon Athena: Serverless SQL over S3; pay per scan.
Comparison: Amazon Redshift vs Amazon Athena · Download PNG · Open card page
Comparison: Amazon Redshift vs Amazon RDS/Aurora. Amazon Redshift: Columnar analytics at scale. Amazon RDS/Aurora: Row-store transactions and apps.
Comparison: Amazon Redshift vs Amazon RDS/Aurora · Download PNG · Open card page
Interview card: Redshift in one sentence?. Managed columnar warehouse for analytics/BI, not OLTP transactions. Use RDS/Aurora for OLTP; Redshift for warehouse. COPY from S3 then BI tools connect.
Interview card: Redshift in one sentence? · Download PNG · Open card page
Interview card: What does DISTKEY do?. Co-locates rows with the same key on the same node to speed joins. Pick a high-cardinality join key used often. fact and dim both DIST on customer_id.
Interview card: What does DISTKEY do? · Download PNG · Open card page
Interview card: What does SORTKEY do?. Physically orders data so zone maps skip irrelevant blocks on filter columns. Time columns are common sort keys. WHERE order_date = today skips old blocks.
Interview card: What does SORTKEY do? · Download PNG · Open card page
Interview card: What is Redshift Spectrum?. Query S3 data lake tables from Redshift SQL without loading everything. Great for cold history; hot stays in local tables. SELECT from spectrum schema for 2019 logs.
Interview card: What is Redshift Spectrum? · Download PNG · Open card page

More cards: Ravi Sir's Cards.

Practice Tasks

About this scenario

Ahmednagar Sugar Co-op is a sugar co-operative business in Ahilyanagar. Balasaheb Pawar looks after its IT and cloud work. They count money in INR and run their AWS resources in the ap-south-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 16

Easy Describe Redshift clusters

Why: Warehouse list.

What to do: Describe clusters.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Describe parameter groups

Why: WLM/settings.

What to do: Describe cluster parameter groups.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Describe tags

Why: Cost/owner.

What to do: Describe tags for arn:aws:redshift:ap-south-1:131959625285:cluster:nagarsugar-dw.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy Columnar helps analytics — 1

Why: Warehouse.

What to do: Enter 1 if columnar storage helps analytics.

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy Not OLTP — 1

Why: Use case.

What to do: Enter 1 if Redshift is for analytics not OLTP.

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Medium Describe one cluster

Why: Inspect size.

What to do: Describe cluster nagarsugar-dw.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe snapshots

Why: Backup points.

What to do: Describe cluster snapshots.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe security groups

Why: Network access.

What to do: Describe cluster security groups.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Describe subnet groups

Why: VPC placement.

What to do: Describe cluster subnet groups.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Allow PauseCluster one

Why: Cost control.

What to do: Allow redshift:PauseCluster on arn:aws:redshift:ap-south-1:131959625285:cluster:nagarsugar-dw.

How:
  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Medium DISTKEY JSON

Why: Join key.

What to do: JSON distkey customer_id.

How:
  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.

Medium Spectrum queries S3 — 1

Why: Lake.

What to do: Enter 1 if Spectrum can query S3.

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Medium Sample node count small lab

Why: Size.

What to do: Sample small lab node count (enter 2)?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Hard Describe events

Why: Ops signals.

What to do: Describe events.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Hard Allow DescribeClusters

Why: Analyst LP.

What to do: Allow redshift:DescribeClusters on *.

How:
  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Hard SORTKEY JSON

Why: Filter key.

What to do: JSON sortkey order_date.

How:
  1. Start from the top-level keys the task names.
  2. Indent child keys with 2 spaces (no tabs).
  3. Fill in each property with the value from the task.
  4. Click Check answer. Key order does not matter.