BEGINNER • Data Modeling Basics
Sprint: optimize query performance #2
This lesson focuses on optimize query performance for a fraud detection pipeline environment. You will use: CREATE TABLE events (id SERIAL PRIMARY KEY) | python -m venv venv | python etl_script.py. The content is designed for practical data engineering execution.
Code Example
-- Data quality check
SELECT
COUNT(*) as total_rows,
COUNT(DISTINCT id) as unique_ids
FROM fact_fraud_detection_pipeline
WHERE created_at >= CURRENT_DATE - 1
-- Objective: optimize query performanceCommands & References
- CREATE TABLE events (id SERIAL PRIMARY KEY)
- python -m venv venv
- python etl_script.py
Lab Steps
- Prepare environment with: CREATE TABLE events (id SERIAL PRIMARY KEY)
- Design or modify the data pipeline for the scenario.
- Validate data quality and document lineage.
- Propose one optimization for production.
Exercises
- Add one data quality check.
- Implement one incremental loading pattern.
- Write a rollback procedure for this pipeline.