ceran
ceran

Reputation: 1412

Azure storage tables, questions regarding query and query processing

I have two short question regarding Azure Storage Tables.

  1. Is there something like an overview of the techniques I can use to query a storage table? I found an example for LINQ, are there alternatives in the .NET framework?

  2. Where does the "query processing" take place? E.g. when using SQL and you send a complex query to your SQL server, this server begins to evaluate it and returns the result to your client. Is it the same for table storage, or gets the client loads of data and has to do the processing itself?

Upvotes: 0

Views: 587

Answers (1)

user94559
user94559

Reputation: 60143

For #1, take a look at the WCF Data Services client library (what's used in .NET to query table storage). You can avoid LINQ if you want to construct URLs by hand, but LINQ is by far the dominant way that people query table storage from .NET code.

For #2, table storage supports very few operations (basically just filters). If you need to do sorting, grouping, etc., you'll need to pull the data down locally first and then query from there. Where things happen depends on the code you write. E.g., the following will fail:

mytable.Select(e => e.PartitionKey == "foo").OrderBy(e => e.SomeTime).Take(10)

because the query will be sent to Windows Azure table storage and fail because tables don't support sorting. However, the following will work (but be very inefficient):

mytable.Select(e => e.PartitionKey == "foo").ToList().OrderBy(e => e.SomeTime).Take(10)

This will result in the entire result set (everything with the "foo" partition key) being pulled down locally, because the .ToList causes the query to be executed. Then once it's all down in memory, it will be sorted and the top ten items returned.

Upvotes: 4

Related Questions