QuestionQ73

Data Operations and Support

A company uses Amazon Redshift to store order transactions for the current day. The company has an orders table that contains prior order data. The company also has a staging table that holds new or updated order records.

The company must remove stale records from the orders table and insert the most recent data from the staging table into the orders table. Several downstream applications require the orders table to show up-to-date information.

Which solution meets these requirements?

  • A Use Amazon Redshift Spectrum to delete stale records from the orders table and insert records from the staging table into the orders table.
  • B Unload the orders table and the staging table to Amazon S3. Delete stale orders table data and insert new staging table data in Amazon S3 by using Amazon Athena. Copy the orders S3 table to the orders Amazon Redshift table.
  • C Use Amazon Athena federated queries to read stale records from the orders table. Delete the stale records and insert the records from the staging table into the orders table.
  • D Write an Amazon Redshift stored procedure that deletes the stale records from the orders table and inserts new records from the staging table.
Explanation

Amazon Redshift stored procedures can execute data-modification statements, including DELETE and INSERT. A stored procedure can delete obsolete rows from the target table and insert the new or updated staging rows in a controlled transaction, so consumers see a consistently refreshed orders table. AWS documents the staging-table approach as deleting replaced target rows and inserting replacement rows from the staging table.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!