1
votes

I made an application where I would query a database with RavenDB. I use it only on my local machine so I want to change from Raven.Server to Embedded client. But I noticed my query time I so high when using embedded client.

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

This is for connection the to the DB. And here is how I exectute my query:

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

Now if I use the EmbeddedDocumentStore my query time is: ~300 ms. If I use DocumentStore and connect to the local server my query time is: 4 - 10 ms.

I would think embedded client is faster? Am I doing something wrong because a query time of 300ms is way to high.

2

2 Answers

0
votes

Probably you aren't getting the benefit from having the server manage everything for you. In particular, you have to re-create the index if it is a temp index.

0
votes

Well, For me it seems that It only a problem while I'm debugging in Visual Studio but if I run the program from the .exe the query times are ok.