Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clear the stl_load_errors table in Redshift?

Is there a way to clear out the contents of the stl_load_errors table in Amazon's Redshift?

I am running batch processes to COPY into Redshift and it would be convenient if I could view the entire stl_load_errors in one go without having to filter by a time range.

When I attempt to DELETE FROM stl_load_errors, I get "ERROR: cannot delete from a system table"

When I attempt to TRUNCATE stl_load_errors, I get "ERROR: permission denied: "stl_load_errors" is a system catalog"

like image 308
Mendhak Avatar asked Oct 16 '14 10:10

Mendhak


People also ask

How do you clear a table in Redshift?

If you are trying to empty a table of rows, without removing the table, use the DELETE or TRUNCATE command. DROP TABLE removes constraints that exist on the target table. Multiple tables can be removed with a single DROP TABLE command.

How do you check Redshift errors?

Amazon Redshift uses the stl_load_errors table to track errors that happen when loading data to a Redshift table. This table contains error messages that will provide necessary detail to determine the cause for an error. For more information on the stl_load_errors table, see Amazon's STL LOAD_ERROR documentation.

How do I find errors in a redshift workflow?

Drag an Input Tool on the canvas. Connect to the Redshift database. Run the workflow. The table will return an error code and an error reason. Use the column "starttime" to find the right error. See Amazon's STL_LOAD_ERROR documentation for a detailed explanation of all fields on the table and their load error reference for a list of errors.

How do I troubleshoot data load issues in Amazon Redshift?

The following Amazon Redshift system tables can be helpful in troubleshooting data load issues: Query STL_LOAD_ERRORS to discover the errors that occurred during specific loads.

Is it possible to delete data from a redshift table?

Nope, you can't delete from that table. It's worth noting that Redshift will automatically clear down that table over time, i.e., it doesn't hold all load errors forever. Show activity on this post.

What is the best way to find errors in STL?

Query STL_LOAD_ERRORS to discover the errors that occurred during specific loads. Query STL_FILE_SCAN to view load times for specific files or to see if a specific file was even read. Query STL_S3CLIENT_ERROR to find details for errors encountered while transferring data from Amazon S3.


2 Answers

Nope, you can't delete from that table.

It's worth noting that Redshift will automatically clear down that table over time, i.e., it doesn't hold all load errors forever.

like image 128
Joe Harris Avatar answered Sep 23 '22 21:09

Joe Harris


You can't delete from stl_load_errors but if you use COPY query from S3 you can filter the SELECT from stl_load_errors using filename. for example: select * from stl_load_errors where filename like 's3://BUCKET/PREFIX_OF_PATH%'

The stl_load_errors will delete old data (usually a week old), so you don't need to worry about disk space.

like image 37
kerbelp Avatar answered Sep 19 '22 21:09

kerbelp