Q86. What are the typical query types for table storage?
There are types in queries for table storage.
Queries can be performed on Azure Table using LINQ statements.
Now let us see each type of query and its performance.
In this type of query, we specify both the Partition Key and Row key in the query. This type of query gives the best performance because it looks up to the exactly correct partition and looks for the exact entity within the partition. This type of query returns a single entity. Note that if no entity exist with the specified Partition key and Row Key, exception is thrown.
In this type of query, we specify the partition key, but there is no exact match for the row key, we give a range for the row key. So, query scans for the entities within the range within a single partition. The query performs well if there are small number of entities and bad if more number of entities present in the partition.
In this type of query, we specify the range for Partition key. So, query involves multiple partitions. The performance of the query depends on the number of entities in different partitions. Note that each partition resides in a separate partition server. If the query involves small number of partition servers then performance is good but if the query has to retrieve entities from more number of partition servers, then performance decreases.
In this type of query, we do not specify a partition key but we specify range on Row key. This query performs the table scan because we do not specify any partition key and performance is bad.
- Point Query
- Row Range Scan
- Partition range Scan
- Table Scan
Queries can be performed on Azure Table using LINQ statements.
Now let us see each type of query and its performance.
1. Point Query
In this type of query, we specify both the Partition Key and Row key in the query. This type of query gives the best performance because it looks up to the exactly correct partition and looks for the exact entity within the partition. This type of query returns a single entity. Note that if no entity exist with the specified Partition key and Row Key, exception is thrown.
2. Row Range Scan (query involves scanning a range of entities within a single partition, hence the name)
In this type of query, we specify the partition key, but there is no exact match for the row key, we give a range for the row key. So, query scans for the entities within the range within a single partition. The query performs well if there are small number of entities and bad if more number of entities present in the partition.
3. Partition range Scan (query involves multiple partitions, hence the name)
In this type of query, we specify the range for Partition key. So, query involves multiple partitions. The performance of the query depends on the number of entities in different partitions. Note that each partition resides in a separate partition server. If the query involves small number of partition servers then performance is good but if the query has to retrieve entities from more number of partition servers, then performance decreases.
4. Table Scan
In this type of query, we do not specify a partition key but we specify range on Row key. This query performs the table scan because we do not specify any partition key and performance is bad.
See More Questions and Answers on - Azure Blobs and Queues
- Partitions and Queries?
- How to insert multiple records in a transaction using TableBatchOperation?
- Partition size in Azure table storage?
- Explain blobs data model?
- How to address resources in the storage emulator?
- Configure a .Net application for using storage emulator?
- How to create a container and upload a blob using the server explorer?
- How to use the windows azure blob storage service in .net?
- Key benefits of SQL database service?