{"action":"created","issue":{"url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/2","repository_url":"https://api.github.com/repos/Crokus/documentdb-repo","labels_url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/2/comments","events_url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/2/events","html_url":"https://github.com/Crokus/documentdb-repo/issues/2","id":131297238,"number":2,"title":"GetById queries are slow","user":{"login":"senseicz","id":44507,"avatar_url":"https://avatars.githubusercontent.com/u/44507?v=3","gravatar_id":"","url":"https://api.github.com/users/senseicz","html_url":"https://github.com/senseicz","followers_url":"https://api.github.com/users/senseicz/followers","following_url":"https://api.github.com/users/senseicz/following{/other_user}","gists_url":"https://api.github.com/users/senseicz/gists{/gist_id}","starred_url":"https://api.github.com/users/senseicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseicz/subscriptions","organizations_url":"https://api.github.com/users/senseicz/orgs","repos_url":"https://api.github.com/users/senseicz/repos","events_url":"https://api.github.com/users/senseicz/events{/privacy}","received_events_url":"https://api.github.com/users/senseicz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-04T10:01:00Z","updated_at":"2016-02-04T15:29:06Z","closed_at":null,"body":"Hi, \r\nI'm having strange issue with performance of GetById queries - while any other query takes no longer than 1 sec (this is locally deployed app connecting to Azure), GetById query takes 15+ seconds.\r\nSo far I'm working with relatively small dataset (between 1-2 thousands documents). I am using GUIDs for Id property.\r\n\r\nI tried to play a bit with indexing but DocumentDB will not allow me to directly index Id field so I'm using:\r\n\r\n```\r\n{\r\n      \"path\": \"/*\",\r\n      \"indexes\": [\r\n        {\r\n          \"kind\": \"Hash\",\r\n          \"dataType\": \"String\",\r\n          \"precision\": -1\r\n        },\r\n        {\r\n          \"kind\": \"Hash\",\r\n          \"dataType\": \"Number\",\r\n          \"precision\": 7\r\n        }\r\n      ]\r\n    }\r\n```\r\nIn my code, I declare my repo like this:\r\n\r\n`_repoAggregationLog = new DocumentDbRepository<AggregationLog>(client, databaseId, () => \"vd\", p => p.Id);`\r\n\r\nand it is declared as singleton for application lifetime, i.e. this is executed only once, not with every query.\r\n\r\nAny idea what I can be doing wrong? Or is it normal that queries by document ID takes so long?\r\n\r\nMany thanks, \r\n\r\nAntonin"},"comment":{"url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/comments/179899092","html_url":"https://github.com/Crokus/documentdb-repo/issues/2#issuecomment-179899092","issue_url":"https://api.github.com/repos/Crokus/documentdb-repo/issues/2","id":179899092,"user":{"login":"senseicz","id":44507,"avatar_url":"https://avatars.githubusercontent.com/u/44507?v=3","gravatar_id":"","url":"https://api.github.com/users/senseicz","html_url":"https://github.com/senseicz","followers_url":"https://api.github.com/users/senseicz/followers","following_url":"https://api.github.com/users/senseicz/following{/other_user}","gists_url":"https://api.github.com/users/senseicz/gists{/gist_id}","starred_url":"https://api.github.com/users/senseicz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/senseicz/subscriptions","organizations_url":"https://api.github.com/users/senseicz/orgs","repos_url":"https://api.github.com/users/senseicz/repos","events_url":"https://api.github.com/users/senseicz/events{/privacy}","received_events_url":"https://api.github.com/users/senseicz/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T15:29:06Z","updated_at":"2016-02-04T15:29:06Z","body":"After some additional investigation, this runs way faster than original GetByIdAsync():\r\n\r\n```\r\npublic async Task<T> GetByIdAsync(string id)\r\n{\r\n     var retVal = await GetDocumentByIdAsync(id);\r\n     return (T)(dynamic)retVal;\r\n}\r\n```"}}