In this video, we will perform query operation in the same order table.
You can see in here if you click the reset now this time I'm going to use Query Operation for that purpose.
Click this query section.
And as you can see that this time we will see both primary key and the sort key.
So query operation is expecting and requiring us both primary k partition key and circuit.
That means it is expecting to us the whole primary key.
So in order to do that, I'm going to add the ID one.
We can see that when we reset this one and click the run button, we have it two items.
And if you click to query and give the partition key ID we need to give also sort key.
So in the sort key, for example, I would like to give delivery.
So if we can run this command, it is to turn us to the first item in the dynamic DB and we can perform
quail patient successfully.
As you can see that we have performed qualification both providing the partition and the third key.
Also, we can add additional filter expressions in here like the scan operation, but this is the best
practice if we have a sort key and would like to seek our table with the sort K, we should run the
query operations.
Scan operations are always costly and we should avoid to run second operations from our applications
using the sort key index dynamo.
DB Exactly knows where this records is using indexes in its database.
It is using the consistent hashing storage run so it can quickly find out where data is and retrieve
data very fast.
So there is no lookup operation when querying with the keys on dynamic DB and this is the best practice
to use to create a command with the sort key when querying your tables so we can also perform the filter
expressions.
If you expand this window, you can give, for example, total price.
Is equal to 5000.
And if you run query, you can see the exact same response.
If you change the value of total price, you can see that there is no item is returned.
So as you can see that we can also run query with the filter expressions.
But the important thing is when performing query operation, you should always pass the primary partition
key and the sort key.