From the course: AWS Certified Data Engineer Associate (DEA-C01) Cert Prep

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Maintaining tables

Maintaining tables

- [Instructor] Imagine that we just got our tables sorted and optimized, and now we have to make a large update like copying more rows into a table. That is definitely going to impact our sorting and slow down our queries. So in this lesson, we'll learn how to maintain our Redshift tables. Redshift maintains metadata about the tables in your database known as statistics. Query Planner uses the statistics to determine the strategy for executing a query. To generate statistics, Redshift uses the ANALYZE operation, which gets a sample of rows from a table, does some calculations, and then saves the resulting column statistics. After loading data into an empty table, Redshift will automatically run the ANALYZE operation. However, if you used a COPY command to add more rows to a table that already has data, the table statistics may need to be updated, but Redshift won't always run the ANALYZE operation again. So, you can add the STATUPDATE ON option to the COPY command, which forces an…

Contents