开发者

RavenDB Shard Querying

How do queries work in sharded RavenDB setup? I know Raven uses lucene for indexing, but querying an index on a specific instance is NOT querying the entire data, so does Raven query all the shard instances and then put the results toget开发者_如何学运维her?

An example I have in mind is say two documents:

{
    Id: 1
    Text: Blah
}

{
    Id: 2
    Text: Blah
}

If I sharded it, say by key, such that they end up on 2 servers, does the query { Text : Blah } return 2 results?


Yes it does.

The docs cover just this example. http://ravendb.net/documentation/docs-sharding

using (var session = documentStore.OpenSession())  
{  
  session.Query<Post>().ToArray();  
}  

The code above will get us all the users, blogs and posts. This is the log output:

Executing query 'Tag:Posts' on index 'Raven/DocumentsByEntityName' in 'Posts #1'
Executing query 'Tag:Posts' on index 'Raven/DocumentsByEntityName' in 'Posts #2'
Executing query 'Tag:Posts' on index 'Raven/DocumentsByEntityName' in 'Posts #3'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜