Dynamodb Query Multiple Primary Keys

DynamoDB encryption at rest provides an additional layer of data protection by securing your data in the encrypted table, including its primary key, local and global secondary indexes, streams, global tables, backups, and DynamoDB Accelerator (DAX) clusters whenever the data is stored in durable media. DynamoDB is a fully managed NoSQL database and you do not have to manage any servers. DynamoDB builds a hash. • DynamoDB stores items that have an arbitrary set of attributes • Each attribute has a name and a value • The only required attributes are its primary key attributes • The primary key can have either one or two dimensions • If the primary key has only one dimension, its value must be unique. In this post, you will learn about some of the following: Is the partition key same as the primary key of a table?. A key condition expression is a search criteria that determines the items to be read from the table or index. DynamoDB cross-region replication allows you to maintain identical copies (called replicas) of a DynamoDB table (called master table) in one or more AWS regions. Jul 16, 2016 · Global secondary indexes are indexes that contains a partition or partition-and-short keys that can be different from the table’s primary key. In Amazon DynamoDB, the collection of items is known as a table. Partition Key: hash key (like the unique key in relational database) Sort Key: range key; Single-attribute partition key. Jan 19, 2012 · Primary Keys & Indexes. DynamoDB supports two different kinds of primary keys: Partition Key and Partition Key and Sort Key. Amazon DynamoDB Tutorial - What is Amazon DynamoDB? Features of Amazon DynamoDB, Installing and Configuring Amazon DynamoDB. For our FoxuTech teams table our Partition Key for sorting our teams is 'name' (string). All queries will be associated with the Primary Key. Next step is to insert items to the DynamoDB Tables previously created. Defaults to the index’s name in the model. The max size for data is 64KB. It also supports a few comparison operators on attribute values to aid in the search process. DynamoDB supports two different kinds of indexes: Global secondary indexes – The primary key of the index can be any two attributes from its table. DynamoDB and MongoDB are two popular NoSQL database options for today's applications. Basics of indexes. … Here I have a standard SQL table … logging game stats for a player. Use the KeyConditionExpression parameter to provide a specific value for the partition key. Let's explore the difference i. With the table full of items, you can then query or scan the items in the table using the DynamoDB. Amazon DynamoDB – What is it ? • Primary key (mandatory for every table) Hash or Hash + Range • Data model in the form of tables • Data stored in the form of items (name – value attributes) • Secondary Indexes for improved performance Local secondary index Global secondary index. Primary key: A primary key is a unique identifier for a single item in a DynamoDB table. DynamoDB is schemaless but requires you to declare the primary key for each table, so we’ve defined this in our AttributeDefinitions and KeySchema. The key is hashed over the different partitions to optimize workload distribution. Query Filtering DynamoDB's Query function retrieves items using a primary key or an index key from a Local or Global Secondary Index. Remove / squash entries in a vertical hash I have a grid that represents an X, Y matrix, stored as a hash here. Secondary Indexes In DynamoDB, you can read data in a table by providing primary key attribute values. It's as if your key is split in two. i’ve setup a few lambda scripts from time to time, but haven’t had any dedicated project time to push forward api serverless concepts. A single operation can retrieve up to 16 MB of data, which can contain as many as 100 items. As a workaround you can create local secondary index for each field that you want to be a range key. DynamoDB Limitations: Limited querying. AWS DynamoDB tables are non-relational and are schema free. DynamoDB - Batch Retrieve - Batch Retrieve operations return attributes of a single or multiple items. Why Secondary Indexes. DynamoDB doesn't require that you use indexes, but they give your applications more flexibility when querying your data. 2 days ago · download dynamodb document client example free and unlimited. The goal of Amazon DynamoDB is to eliminate this complexity and operational overhead for our customers by offering a seamlessly scalable database service. Consistency. For details, see the CouchDB query options. As no Hash Key was specified it would instead create a SCAN Request where as there’s no index, it adds all conditions to the Filter Expression. Jan 07, 2019 · DynamoDB supports a document oriented data model. it has different types of daemons running on specific hosts of cluster like impala daemon, statestore and catalog services, which we will discuss in the coming sections. DynamoDB query on boolean key Tag: node. Query and Scan Operations in DynamoDB. It's extremely fast, flexible and highly available, and these features make it an important building block for many architectural designs. DynamoDB does not have a query optimizer, so a secondary index is only used when you query it or scan it. RazorSQL has been tested on over 40 databases, can connect to databases via either JDBC or ODBC , and includes support for the following databases:. Query - primary search operation to find items in a table or a secondary index using only primary key attribute values. A Query operation always returns results, but can return empty results. DynamoDB also provides flexible querying by letting you query on nonprimary key attributes using global secondary indexes and local secondary indexes. Since Transposit lets you easily create multiple connectors to the same service, you can use Transposit to move data between different DynamoDB tables in different accounts or regions. Now, a Range key might be part of the schema of the base table or an index (LSI, GSI) but it will always be part of a primary key, and will always be accompanied by a Hash key. Problems & Solutions beta; Log in; Upload Ask Computers & electronics; Software; Amazon DynamoDB - Developer Guide. In this talk, I will talk about how developers can build applications on DynamoDB without having to deal with the complexity of operating a large scale database. Amazon DynamoDB gives you the flexibility to query on any attribute (column) using global and local secondary indexes. Mar 21, 2017 · DynamoDB creates and maintains indexes for the primary key attributes for efficient access of data in the table, which allows applications to quickly retrieve data by specifying primary key values. DynamoDB supports two different kinds of indexes: Global secondary indexes – The primary key of the index can be any two attributes from its table. A Query operation uses the primary key of a. The next step on DynamoDB’s Getting Started is to retrieve items by their key. The Query operation finds items based on primary key values. you probably shouldn’t use dynamodb - ravelin dynamodb create table - thomas henson. To scan the data, you choose either a [Table] entry that contains the primary key and sort key, or an [Index] entry that sorts the data based on a secondary index that you create. DynamoDB uses primary keys to uniquely identify each item in a table and secondary indexes to provide more querying flexibility. js , amazon-web-services , nosql , amazon , amazon-dynamodb I'm new to DynamoDB (and to noSQL in general) and am struggling a little to get my head round some of the concepts. DynamoDB Transactions are particularly useful for modelling relational data, where relationships between entities are written across multiple records Use the primary key to query where PK. DynamoDB does not require a predefined schema and allows adding new attributes on the fly at the application level, but it does require you to identify the attribute names and data types for the table's primary keys, sort keys, and local secondary indexes. Supports all key types - primary hash key and composite keys. is not part of our Primary. In the HyperDex model that means over all defined spaces in the cluster. DB2 Alter Table Add Primary Key. Additionally, in case you want to point to the web version, you will need to set up: AWS_ACCESS_KEY_ID. A primary key uniquely identifies an item. You can also define secondary indexes on non-key attributes, and query your data using an alternate key. I have a pre-existing dynamo db table to which I want to add a primary sort key. net api part 2: code beginnings. Amazon's DynamoDB only provides the ability to search based on 2 keys, the primary key and the range key. impalaql is a subset of hiveql, with some functional limitations like transforms. You specify the primary key when you create a table. DynamoDB offers four low-level actions for data reading − GetItem − It accepts a primary key and returns attributes of the associated item. table_name - The name of the table to query. When creating a new table, you define the primary key and type of key to be used. …First, we're going to have to set up the table…by defining the table schema. Use the KeyConditionExpression parameter to provide a specific value for the partition key. Each table contains multiple items, where each item is composed of multiple attributes. DynamoDB allows you to create two types of primary keys: Partition Key — A simple primary key that has the value of the partition in which the data is stored. You can query any table or secondary index that has a composite primary key (a partition key and a sort key). Amazon DynamoDB Tutorial - What is Amazon DynamoDB? Features of Amazon DynamoDB, Installing and Configuring Amazon DynamoDB. DynamoDb provides two ways for searching the database: 1. You can Query any DynamoDb table or secondary index, provided that it has a composite primary key (partition key and sort key) Multiple key condition / filter. DBMS > Amazon DynamoDB vs. Parition Key. DynamoDB uses tables, items and attributes as the core components that you work with. Features: Key-value and document data model support. Otherwise, all attributes will be returned. DynamoDB supports the Query operation on tables whose primary key is composed of both hash and range attributes. (each SNS message has a unique UUID, that will be our partition key) - Note: Depending on your use case, you may want to use a different value as the partition key and/or set up a global secondary index over email address. Note that this is not a query method - it will only return the object matching the exact primary key provided. For more details, you can check out book Mastering DynamoDB by Tanmay Deshpande. DescribeTableif the primary key or indexes are needed to build the query. …And then we're going to perform…the two types of query operations. Amazon DynamoDB builds an unordered hash index on this primary key attribute. Next step is to insert items to the DynamoDB Tables previously created. Hash key example: "ChallengeId" = 1219. … Now, if I want to query this table by PlayerID, …. Amazon's http api is complicated and non obvious how to interact with it. Instead it just queries on the primary key and filters the results for the range key condition. Model entities for the DynamoDB data source type are based on the tables in your DynamoDB instance. A Query operation directly accesses items from a table using the table primary key, or from an index using the index key. The following section illustrates that strategy, and also describes how items having a sort key are stored. For example, when you wanted to distribute the particular primary key across volumes then don’t have to use data stamps or consecutive integers as primary keys. Also, DynamoDB employs primary keys in exclusively identifying the individual item in a table. For example,. This requirement is based on the observation that a significant. All the items in the table contain the key which I want to delegate as the primary sort key. The former is used for the same purposes as in a simple primary key, while the latter sorts data within one partition. The Query operation will return all of the items from the table or index with that partition key value. on StudyBlue. Supports all key types - primary hash key and composite keys. A Primer on the DynamoDB NoSQL database. Since launching to the public on January 2, 2013, Tuition. Query DynamoDB Items With Java The main rule is that every query has to use the hash key. DynamoDB is not a relational database, so you're going to have to stop thinking of it in those terms. The primary key name and type must be specified on table creation, and a primary key of the specified type must be included with each item written to a table. Is there a way to query multiple hash keys using a single query in Amazon's AWS SDK for Java? Here's my issue; I have a DB table for project statuses. Find items based on primary key values. Define a naming convention for keys values; keys could be constructed using a combination of the row's primary key and a column name. You pay a flat, hourly rate based on the capacity you reserve:. Now, a Range key might be part of the schema of the base table or an index (LSI, GSI) but it will always be part of a primary key, and will always be accompanied by a Hash key. You can query any table or secondary index that has a composite primary key (a partition key and a sort key). Simple Hash Key gives DynamoDB the Distributed Hash Table abstraction. All this is great, but key design for DynamoDB results in some unexpected challenges. However, sometimes you have additional access patterns that would be inefficient with your primary key. joins) or complex transactions?. DynamoDB query examples. Primary keys for time series tables. Remove / squash entries in a vertical hash I have a grid that represents an X, Y matrix, stored as a hash here.   The composite primary key consists of both partition key and sort key. AWS_BDS-C00 Exam Leading the way in IT testing and certification tools, www. The index key schema can differ from the table, and index key attributes can use any top-level string, number, or binary table attributes. The primary key uniquely identifies each item in the table, so that no two items can have the same key. For more details, you can check out book Mastering DynamoDB by Tanmay Deshpande. Each query can use Boolean comparison operators to control which items will be returned. Is there any way to do it with DynamoDB? For example, my primary key is a string, and I want to get all the items that start with an A. Local Secondary Indexes do not incur extra cost, but Global Secondary Indexes require additional read and write capacity provisioned leading to. For details, see the CouchDB query options. Microsoft Azure Cosmos DB. For more information, see Partitions and Data Distribution. Especially because spring-boot does a lot of auto-magic behind the curtain via the implicit existing @EnableJpaRepositories. DBMS > Amazon DynamoDB vs. Question 9) Does Amazon DynamoDB support conditional operations? For an operation to be completed on an item, you have to specify a condition. The query operation uses the primary key of a table or a secondary index, to directly access items from that table or index. The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. For a composite primary key, you must provide both values for both the partition key and the sort key. Efficient Indexing: Every item in a DynamoDB table is identified by a primary key, allowing you to access data items quickly and efficiently. But you will not be able to build query with multiple range keys simultaneously because DynamoDB can only use one index at a time. For advanced users only. DynamoDB supports various data types for its attributes, which are as follows:. Lookup only on the primary key (hash or hash + range) The only operation you can do – Get, Put, Update, BatchWrite, Query (on the range) and Scan (which is slow and not a good idea). python examples how to choose an aws profile when using. download items dynamodb free and unlimited. The partition key of an item is also known as its hash attribute. Jun 27, 2016 · On a previous article we learned how to create DynamoDB Tables using Node. Since one of the requirements for DynamoDB is that the primary key be unique, then there needs to be a combination of attributes that uniquely identifies a record. DynamoDB is a NoSQL database suitable for storing document and key/value type data, like JSON objects. This session is designed for developers, engineers, and database administrators who are…. (For more information, see Partitions and Data Distribution. You can query any table or secondary index that has a composite primary key (a partition key and a sort key). –One attribute must be the primary key •Primary key can be a single partition key attribute •Or a pair of (partition key k1, sort key k2) –Items partitioned across nodes on k1 –Sorted within the node on k2 CSE 444 -Winter 2019 35 Amazon DynamoDBQuerying •Selection and projection queries –Equality predicates on primary key –Must. Later, you might decide to split out multiple query groups:. You can query any table or secondary index that has a composite primary key (a partition key and a sort key). For example, it supports only one numeric type and does not support dates. Oct 16, 2019 · Redis is an open source, BSD licensed, advanced key-value store. The query operation in DynamoDB is different from how queries are performed in relational databases due to its structure. Key factors that directed us to choose Amazon DynamoDB are: It's part of the AWS family, and our entire platform is built on AWS and using a solution from AWS itself was one of the top priorities. DynamoDB- Primary Keys: DynamoDB stores and retrieve data based on Primary key. Here, we may want to query items on their names or group them by the manufacturer. • A composite primary key, composed of two attributes. Use the KeyConditionExpression parameter to provide a specific value for the partition key. Sadly, as of this writing, DynamoDB misses on this feature out of the box. …And there's a regular query operation that searches…only the primary key, then it. Any of my search term words; All of my search term words; Find results in Content titles and body; Content titles only. In addition to that DynamoDB provides flexible querying by letting you query on non-primary key attributes using Global Secondary Indexes and Local Secondary Indexes. userId) is duplicated to multiple tables and the application suddenly needed to. DynamoDB supports GET/PUT operations by using a user-defined primary key. For example, it supports only one numeric type and does not support dates. js how do you query for a non-existent(null) attribute in dynamodb i'm trying to query a dynamodb table to find all items where the email attribute ややこしいドキュメントを何度も挫折しそうに. Getting the most out of DynamoDB throughput “To get the most out of DynamoDB throughput, create tables where the partition key element has a large number of distinct values, and values are requested fairly uniformly, as randomly as possible. It doesn't allow you to change the primary key of the tables either. The primary key uniquely identifies each item in the table, so that no two items can have the same key. This database system provides consistent latency and offers built-in security, and in-memory caching. Query method and a set of expressions to get and then print the item that has an Id of 301 , but only if the value of Price is greater than 150. Records can be looked up using the hash key very efficiently. Items in DynamoDB correspond to rows and attributes correspond to columns in RDBMS. Supports all key types - primary hash key and composite keys. Later, you might decide to split out multiple query groups:. You need to know the key of your object and you can only update based upon that key, updating a single record at a time. there are two types of indexes in dynamodb, a local secondary index (lsi) and a global secondary index (gsi). In this walkthrough, we're going to create a multi-region, multi-master, geo-routed application—all in about 30 minutes. By default, a Query operation returns all the attributes of a given item, but there is an option available to limit the attributes using ProjectionExpressions. The query operation in DynamoDB is different from how queries are performed in relational databases due to its structure. Dec 12, 2013 · These query capabilities so far have been based on the default primary index and optional local secondary indexes of a DynamoDB table: Primary Index: Customers can choose from two types of keys for primary index querying: Simple Hash Keys and Composite Hash Key / Range Keys. DBMS > Amazon DynamoDB vs. Get Multiple Items by Using Expressions and the Table's Primary Key# The following example features the Amazon. You can query only Primary Key and Secondary Key attributes from a table in DynamoDB. AWS_BDS-C00 Exam Leading the way in IT testing and certification tools, www. primary key will point to exactly one item. DynamoDB supports three data types: number, string, and binary, in both scalar and multi-valued sets. create key pair for ec2 instance. Value of the partition key is input to an internal hash function which determines the partition or physical location of which the data is stored. Jul 09, 2017 · Rather than making 12 (or more) Query calls to 12 DynamoDB tables partitioned by month, only one call can be made to reduce expensive lookups and further reduce latency. Primary key ID expressed indirectly through multiple conditions. Creating a table. AWS DynamoDB Secondary Indexes. The Query operation finds items based on primary key values. There are several methods of partition like Hash, DB2, Random etc. The primary focus of this project was to get the best throughput for the query search on this website. Each table requires a primary key to identify its corresponding data item. If the primary key is simple, it contains only a partition key that determines what node and what partition are going to store the data. Why Secondary Indexes. amazon dynamodb is a fully managed nosql database services offered by amazon as part of its amazon web. Then, we'll seed it with some data using the BatchWriteItem API call. DynamoDB - Multiple range keys. Attr classes. You can only update an entire blob at a time. Partition Key - Unique attribute. The primary focus of this project was to get the best throughput for the query search on this website. DynamoDB Query. RazorSQL - Query, Edit, Browse, and Manage Databases RazorSQL is an SQL query tool, database browser, SQL editor, and database administration tool for Windows, macOS, Mac OS X, Linux, and Solaris. A partition is a physical space where data is stored. To process a list of values, the SELECT may have to query many nodes, which degrades performance. On-line dynamic file shrink facility Issued. It also lists the other tables available on the database so that the user can choose a referenced table and referenced column or columns. Let's use. Note that the table contains one primary key column, SingerId, which appears to the left of the bolded line, and that tables are organized by rows, columns, and values. For DynamoDB, you may require to do some efforts and put more time to design database tables, indexes, keys, attributes, etc. With today's release, we are extending this model with support for query filtering on non-key attributes. You can Query any DynamoDb table or secondary index, provided that it has a composite primary key (partition key and sort key) Multiple key condition / filter. DynamoDB is a good fit when you have an obvious primary key and want to be able to store and query large amounts of data quickly. 2 days ago · download hbase catalog example free and unlimited. Join us for the first-ever Amazon DynamoDB practical hands-on workshop. The Query operation finds items based on primary key values. Query method, search is restricted to the primary key attribute values. It represents a one-to-many relationship based on the partition key and enables querying on the sort key attribute. A Query operation will return all of the items from the table or index with the partition key value you provided. key - A DynamoDB-style HashKeyValue. Getting documents out of DynamoDB is more lookup based on a known key than query, which makes it seem more like a file system than a database. Poor manual partition key selection can dramatically impact query performance, so Redshift does it for you Can partition by any key with up to 20,000 per table Supports several Serializer/Deserializer (SerDe) libraries for parsing data from different data formats: CSV, JSON, TSV, and Apache logs. Download Presentation Amazon DynamoDB An Image/Link below is provided (as is) to download presentation. In this lesson, we'll create a table with a composite primary key. range_key_conditions - A Python version of the RangeKeyConditions data structure. However, you may want to enable additional access patterns, such as retrieving all books in a. For this reason 2 items in a table cannot have the same partition key value when primary key is single attribute. Refer to the documentation for DynamoDB for more information about using best practices to model data in DynamoDB tables. (For more information, see Partitions and Data Distribution. DynamoDB works on the basis of the collection of nodes with each node managing a particular set of primary keys. Each table contains multiple items, where each item is composed of multiple attributes. - Primary key (partition key, hash key) "messageId", type string. However, you may want to enable additional access patterns, such as retrieving all books in a. Elastic Map Reduce allows you to conveniently run SQL-like queries against DynamoDB using Hive. In addition, DynamoDB also supports the Scan operation on a table. What optional arguments can be provided within a DynamoDB query?. Besides that, you can use whichever attributes you like on the fly. query: A specific query array to filter data against options: An object with a paginate property as number. Each Customer, each Order, each Shipper record gets an item in our new table. You can query any table or secondary index that has a composite primary key (a partition key and a sort key). DynamoDB can hold both structured or semi-structured data, such as JSON or XML. batchGetItemAsync(BatchGetItemRequest) - Method in interface com. Is this possible using nodejs within Lambda and allow alexa to read back all the items?. Do NOT define a Local Secondary Index or Global Secondary Index. You need to know the key of your object and you can only update based upon that key, updating a single record at a time. net Volume: 297 Questions. query dynamodb items with node. In this talk, I will talk about how developers can build applications on DynamoDB without having to deal with the complexity of operating a large scale database. js Lambda & DynamoDB Purpose The purpose of this project is to show a way to get your AWS Lambda (Node. Interfacing Amazon DynamoDB with Python using Boto3 With Query you can query on the Hash/Range key, but not on non key attributes. Local Secondary Index (LSI) – Has the same partition key as the base table with different sort key. As a workaround you can create local secondary index for each field that you want to be a range key. Sep 20, 2013 · Primary key attribute names. In the next lessons, we'll work with this data using the Query and Scan API calls. For example, a simple primary key would be represented by one KeySchemaElement (for the partition key). You can't have more than 2 fields as primary key in DynamoDB. dynamodb vs mongodb compare mongodb with dynamodb edureka. Scans have the advantage of being a bit more free-form than queries. For DynamoDB, you may require to do some efforts and put more time to design database tables, indexes, keys, attributes, etc. Query and Scan Operations in DynamoDB. Below is a diagram showing a table named People: Note about tables: Each item in the table has a unique identifier, or primary key, that distinguishes the item from all of the others in the table. DynamoDB can hold both structured or semi-structured data, such as JSON or XML. Lookup only on the primary key (hash or hash + range) The only operation you can do - Get, Put, Update, BatchWrite, Query (on the range) and Scan (which is slow and not a good idea). Jan 30, 2018 · DynamoDB supports two different kinds of primary keys: Partition Key—A simple primary key, composed of one attribute known as the partition key. To those familiar with DynamoDB, I'm trying to make a table where items only have 2 entries. Partition Key or formally known as Hash Key. In SQL, you use the SELECT statement to retrieve data from a table. The former is used for the same purposes as in a simple primary key, while the latter sorts data within one partition. Jul 11, 2013 · DynamoDB is schema-less, but the design of your keys has a big impact on application design, throughput performance, and cost. This module accepts explicit DynamoDB credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. range_key_conditions - A Python version of the RangeKeyConditions data structure. Query method. Note that this is not a query method – it will only return the object matching the exact primary key provided. Interfacing Amazon DynamoDB with Python using Boto3 With Query you can query on the Hash/Range key, but not on non key attributes. For a composite primary key, you must provide both values for both the partition key and the sort key. Used primary for large queries with upper limitation of 100. download items dynamodb free and unlimited. Each table requires a primary key to identify its corresponding data item. python and aws sdk make it easy for us to move data in the ecosystem. introduction. • The first attribute is the partition key, and the second attribute is the sort key. You need to know the key of your object and you can only update based upon that key, updating a single record at a time. The primary key name and type must be specified on table creation, and a primary key of the specified type must be included with each item written to a table. DynamoDB limits the size of an item (record) to 64KB. DynamoDB vs MongoDB. Hive Query:. Since Transposit lets you easily create multiple connectors to the same service, you can use Transposit to move data between different DynamoDB tables in different accounts or regions. partition key + sort key (unique) 2 items cam have same partition key but must have a different sort key. It allows up to 5 Local Secondary Index and up to 5 Global Secondary Index. A table in DynamoDB needs a primary key, and the primary key always enforces a unique constraint. A primary key consists of one or two attributes: A mandatory field, the hash key. What is a Query? - A Query operation finds items in a table using only primary key attribute values. Indexing comes into the picture if you want to fetch the data of attributes other than the primary key. These operations generally consist of using the primary key to identify the desired i. The first operation searches the index table to retrieve the primary key, and the second uses the primary key to fetch the data. Does Amazon DynamoDB support increment or decrement operations?. The composite primary key will give us the Query ability on the HASH key to satisfy one of the query patterns we need. All this is great, but key design for DynamoDB results in some unexpected challenges. ♦It is used to. For example, it supports only one numeric type and does not support dates. using amazon dynamodb with the aws. attributes_to_get - A list of attribute names. They key to using the command is to pass the request to use keys in the JSON file. For structured documents, multiple writers can concurrently modify properties of the same item, or even append to the same array. Since we are using both Parition Key and Sort Key DynamoDB will hash the keys across the AWS region. DynamoDB uses the partition key’s value as input to an internal hash function. Jan 19, 2012 · Primary Keys & Indexes. Query vs Scan. A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index. Global Secondary Indexes (GSI) are indexes that contain partition or composite partition-and-sort keys that can be different from the keys in the table on which the index is based. All queries will be associated with the Primary Key. Keep in mind that for the insert action the most basic step is to specify the the primary key. A partition key is a single attribute primary key.