Loading
Extend Salesforce with Clicks, Not Code
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Sort Example for Orders and Order Items in Amazon DynamoDB

          Sort Example for Orders and Order Items in Amazon DynamoDB

          To effectively sort orders and order items stored in an Amazon DynamoDB table in a way that benefits a business process, create secondary indexes that identify attribute values as the basis for sorting.

          A secondary index allows efficient access to data with attributes other than the primary key values. You can create multiple secondary indexes and give your applications access to different query patterns. A general rule of thumb for creating indexes:

          When you query for rows that match condition A, you want to sort the results by attribute B.

          A secondary index is a data structure that contains a subset of attributes you select from the table. You must select all the attributes that you want to appear in the query results, even if they’re not used for sorting.

          Suppose you want to sort orders for a customer by date, and then sort the line items within an order by quantity. To do this, an Amazon DynamoDB administrator must create specific indexes to support the query and the sort operation:

          • customerID-orderDate-index: query for the orders for a specific customer (partition key), then sort by date (sort key).
          • orderID-quantity-index: query for the order items for a specific order (partition key), then sort by quantity (sort key).

          If you want to display unit price and any other corresponding details for orders or order items, make sure to include the attributes while you’re creating the index.

           
          Loading
          Salesforce Help | Article