我创建了一个应用程序,在该应用程序中,我将使用RavenDB查询数据库。我只在我的本地机器上使用它,所以我想从Raven.Server改为嵌入式客户机。但是我注意到当使用嵌入式客户端时,我的查询时间太长了。
私有静态EmbeddableDocumentStore documentStore { get;set;}
public static void Connect()
{
documentStore = new EmbeddableDocumentStore() {/* Url = "http://" + Properties.Settings.Default.DatabaseHost + ":" + Properties.Settings.Default.DatabasePort */ DataDirectory = "Data"};
documentStore.Initialize();
IndexCreation.CreateIndexes(typeof(eBayItemIndexer).Assembly, documentStore);
IndexCreation.CreateIndexes(typeof(RemoveIndexer).Assembly, documentStore);
}这是为了连接到DB。下面是我如何解释我的问题:
session.Advanced.DocumentStore.DatabaseCommands.Query("eBayItemIndexer", new Raven.Abstractions.Data.IndexQuery() { Query = RawQuery }, new string[] { "Id" });现在,如果我使用EmbeddedDocumentStore,我的查询时间是:~300 ms。如果我使用DocumentStore并连接到本地服务器,我的查询时间是:4-10 ms。
我会认为嵌入式客户机更快吗?我是不是做错了什么,因为300 is的查询时间太高了。
发布于 2013-05-29 17:30:54
可能您没有从让服务器为您管理一切中获益。特别是,如果索引是临时索引,则必须重新创建它。
发布于 2013-06-08 12:01:22
对我来说,这似乎只是在Visual中调试时的一个问题,但是如果我从.exe运行程序,查询时间就可以了。
https://stackoverflow.com/questions/16815299
复制相似问题