Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7898453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:26:16+00:00 2026-06-03T08:26:16+00:00

I have a table called products with primary key Id . I want to

  • 0

I have a table called products with primary key Id. I want to select all items in the table. This is the code is I’m using:

$batch_get_response = $dynamodb->batch_get_item(array(
    'RequestItems' => array(

        'products' => array(
            'Keys' => array(
                array( // Key #1
                    'HashKeyElement'  => array( AmazonDynamoDB::TYPE_NUMBER => '1'),
                    'RangeKeyElement' => array( AmazonDynamoDB::TYPE_NUMBER => $current_time),
                ),
                array( // Key #2
                    'HashKeyElement'  => array( AmazonDynamoDB::TYPE_NUMBER => '2'),
                    'RangeKeyElement' => array( AmazonDynamoDB::TYPE_NUMBER => $current_time),
                ),
            )
        )
    )   
));

Is it possible to select all items without specifying the primary key? I’m using the AWS SDK for PHP.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:26:17+00:00Added an answer on June 3, 2026 at 8:26 am

    Amazon DynamoDB provides the Scan operation for this purpose, which returns one or more items and its attributes by performing a full scan of a table. Please be aware of the following two constraints:

    • Depending on your table size, you may need to use pagination to retrieve the entire result set:

      Note
      If the total number of scanned items exceeds the 1MB limit, the
      scan stops and results are returned to the user with a
      LastEvaluatedKey to continue the scan in a subsequent operation. The
      results also include the number of items exceeding the limit. A scan
      can result in no table data meeting the filter criteria.

      The result set is eventually consistent.

    • The Scan operation is potentially costly regarding both performance and consumed capacity units (i.e. price), see section Scan and Query Performance in Query and Scan in Amazon DynamoDB:

      […] Also, as a table grows, the scan operation slows. The scan
      operation examines every item for the requested values, and can use up
      the provisioned throughput for a large table in a single operation
      .
      For quicker response times, design your tables in a way that can use
      the Query, Get, or BatchGetItem APIs, instead. Or, design your
      application to use scan operations in a way that minimizes the impact
      on your table’s request rate. For more information, see Provisioned
      Throughput Guidelines in Amazon DynamoDB
      . [emphasis mine]

    You can find more details about this operation and some example snippets in Scanning Tables Using the AWS SDK for PHP Low-Level API for Amazon DynamoDB, with the most simple example illustrating the operation being:

    $dynamodb = new AmazonDynamoDB();
    
    $scan_response = $dynamodb->scan(array(
        'TableName' => 'ProductCatalog' 
    ));
    
    foreach ($scan_response->body->Items as $item)
    {
        echo "<p><strong>Item Number:</strong>"
             . (string) $item->Id->{AmazonDynamoDB::TYPE_NUMBER};
        echo "<br><strong>Item Name: </strong>"
             . (string) $item->Title->{AmazonDynamoDB::TYPE_STRING} ."</p>";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say that hypothetically I have a table called Products with a primary key
Hey, I have a table called products that has a relationship with itself. This
I have a column in table recipes called Products. This is is filled like
I have a table called indx_0 where I select all pid (product id) cominations
I have a table called Orderrow. Orderrow has a a compound primary key (CPK)
I have a table called Products in my database. It has a couple of
I have a table called products containing a field called price and I simply
I have a products table with a column of type SET (called especialidad), with
Hi I have table called Sold Products which stores buying information for product &
I have a product table called products It has 3 fields (name,model(PK), and class_name).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.