2013-05-29 42 views
1

我做了一個應用程序,我會用RavenDB查詢數據庫。我只在我的本地機器上使用它,所以我想從Raven.Server更改爲嵌入式客戶端。但是在使用嵌入式客戶端時,我注意到我的查詢時間非常高。嵌入RavenDB與Raven.Server

private static EmbeddableDocumentStore documentStore {get;組; }

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); 
    } 

這是連接到數據庫。 這裏是我如何exectute我的查詢:

session.Advanced.DocumentStore.DatabaseCommands.Query("eBayItemIndexer", new Raven.Abstractions.Data.IndexQuery() { Query = RawQuery }, new string[] { "Id" }); 

現在,如果我用我的EmbeddedDocumentStore查詢時間爲:〜300毫秒。 如果我使用DocumentStore並連接到本地服務器,則我的查詢時間爲:4 - 10 ms。

我認爲嵌入式客戶端更快?我做錯了什麼,因爲300毫秒的查詢時間是很高的。

回答

0

也許你沒有從服務器管理你的一切中受益。特別是,如果它是一個臨時索引,則必須重新創建索引。

+0

但我創建了我的永久索引(在void Connect()中) – Svexo

0

嗯,對我來說,它似乎只是一個問題,而我在Visual Studio中調試,但如果我從.exe運行該程序查詢時間是好的。