简体   繁体   中英

Querying azure table for multiple entities

I'm writing azure application. My questions concerns querying azure table for specific entities.

Application stores statistics of words used by users. In table partitionkey is the language and row key is the word.

I need to query for multiple words. To speed up the process I want to pull in one query all relevant entities.

I know how to 'batch insert' group of entities that have the same partitionkey. How to query for like 50 diffrent entities with the same partitionkey but different rowkey.

Is there possibility of specifying query as string ?

Regards

You can specify up to 15 matches in your $filter , so essentially 15 specific rowkeys if you went down that route. Note: This will result in a partition scan. Specifics on querying are in this article .

There's more information in this StackOverflow question and related answers.

But one query would not necessarily speed it up. Issue 5 queries of 10 words each (possibly in parallel) and combine the results.

It's not the question you asked, but you may find that you'll get better performance out of this specific query if you reverse the RowKey and PartitionKey. I'm guessing that there could be quite a few words in a language so this will mean that you'll have quite large partitions. If you try to parallelise your query as suggested by others (which is a good idea) all of these queries will be hitting the same partition with your current key plan.

If you did reverse the keys though it would mean that getting a list of words for a particular language will be really quite inefficient.

I'm not aware of any easy way to do it, but there are some dynamic LINQ query libraries that you could use.

You might want to check out this question:
Parsing a string C# LINQ expression

And these libraries:
Dynamically generate a LINQ query with a custom property
Invent your own Dynamic LINQ parser

And this tutorial:
Dynamic LINQ (Part 1: Using the LINQ Dynamic Query Library)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM