🎬No video for this question yet. The written answer is below.
What did you work on in Redshift?- Oracle DB Questions (project experience based)
- Redshift Tuning (real-time scenarios)
- What Python libraries have you used?
📝 Answer
Interviewer:
What kind of work have you done in Amazon Redshift?
Candidate:
So basically, in my project, Redshift was the final data warehouse where we stored processed and analytics-ready data.
First, I was involved in designing schemas. We used star schema where fact tables stored transactional data and dimension tables stored descriptive data.
Then I worked on data loading. We used COPY command to load data from S3 into Redshift. This was much faster compared to inserting row by row.
In one of my projects, I handled incremental loads. Instead of loading full data every time, I implemented logic to load only new or updated records.
I also worked on writing complex SQL queries for reporting and dashboards. These queries involved joins, aggregations, and window functions.
One challenge I faced was slow query performance. Then I started focusing on distribution keys and sort keys to optimize performance.
So basically, my work in Redshift involved schema design, data loading, query writing, and performance optimization.
COPY sales_data FROM 's3://bucket/path/' IAM_ROLE 'arn:aws:iam::account-id:role/redshift-role' FORMAT AS PARQUET;
Interviewer:
Can you explain your experience with Oracle DB in real-time projects?
Candidate:
So basically, I worked with Oracle in one of my earlier projects before moving to cloud-based systems.
I mainly used Oracle as a source system. I extracted data from Oracle tables and loaded it into data pipelines.
I worked with complex queries, joins, and stored procedures.
One important thing I handled was query optimization. Some queries were very slow, so I used indexes and analyzed execution plans to improve performance.
I also worked with partitions in Oracle tables to handle large datasets efficiently.
In one case, I had to migrate data from Oracle to Redshift, and I designed ETL pipelines for that.
So basically, my experience includes data extraction, query optimization, and integration with ETL pipelines.
Interviewer:
How do you tune Redshift for better performance? Can you give real-time scenarios?
Candidate:
So this is something I learned while working in production.
First, I look at distribution keys. If data is not distributed properly, joins become slow due to data movement.
In one project, I changed the distribution key based on join columns, and it reduced query time significantly.
Then sort keys. These help in faster filtering and range queries. For example, I used date columns as sort keys for time-based queries.
I also use compression encoding. This reduces storage and improves performance.
Another thing I focus on is vacuum and analyze. After multiple inserts and deletes, tables become fragmented, so I run vacuum to clean up.
I also monitor queries using system tables to identify slow queries.
So basically, tuning involves distribution, sorting, compression, and maintenance operations.
Interviewer:
What Python libraries have you used in your projects?
Candidate:
So basically, I’ve used a variety of Python libraries depending on the use case.
For data processing, I used pandas for small to medium datasets.
For big data, I used PySpark.
For AWS integration, I used boto3 to interact with services like S3 and Lambda.
For API calls, I used requests.
For validation, I used Pydantic in one of my projects.
I also used logging for monitoring and debugging.
In one of my ETL pipelines, I combined boto3 and pandas to read data from S3, process it, and load it into Redshift.
So basically, I choose libraries based on data size and use case.
Interviewer (Follow-up):
That’s great. Can you explain a scenario where wrong distribution key caused a performance issue in Redshift?