{"action":"created","issue":{"url":"https://api.github.com/repos/upper/db/issues/80","labels_url":"https://api.github.com/repos/upper/db/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/upper/db/issues/80/comments","events_url":"https://api.github.com/repos/upper/db/issues/80/events","html_url":"https://github.com/upper/db/issues/80","id":81047076,"number":80,"title":"conn.Collection(\"x\") should cache the db.Collection ","user":{"login":"pkieltyka","id":18831,"avatar_url":"https://avatars.githubusercontent.com/u/18831?v=3","gravatar_id":"","url":"https://api.github.com/users/pkieltyka","html_url":"https://github.com/pkieltyka","followers_url":"https://api.github.com/users/pkieltyka/followers","following_url":"https://api.github.com/users/pkieltyka/following{/other_user}","gists_url":"https://api.github.com/users/pkieltyka/gists{/gist_id}","starred_url":"https://api.github.com/users/pkieltyka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pkieltyka/subscriptions","organizations_url":"https://api.github.com/users/pkieltyka/orgs","repos_url":"https://api.github.com/users/pkieltyka/repos","events_url":"https://api.github.com/users/pkieltyka/events{/privacy}","received_events_url":"https://api.github.com/users/pkieltyka/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/upper/db/milestones/7","html_url":"https://github.com/upper/db/milestones/2.0-beta1","labels_url":"https://api.github.com/repos/upper/db/milestones/7/labels","id":1107111,"number":7,"title":"2.0-beta1","description":"","creator":{"login":"xiam","id":385670,"avatar_url":"https://avatars.githubusercontent.com/u/385670?v=3","gravatar_id":"","url":"https://api.github.com/users/xiam","html_url":"https://github.com/xiam","followers_url":"https://api.github.com/users/xiam/followers","following_url":"https://api.github.com/users/xiam/following{/other_user}","gists_url":"https://api.github.com/users/xiam/gists{/gist_id}","starred_url":"https://api.github.com/users/xiam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiam/subscriptions","organizations_url":"https://api.github.com/users/xiam/orgs","repos_url":"https://api.github.com/users/xiam/repos","events_url":"https://api.github.com/users/xiam/events{/privacy}","received_events_url":"https://api.github.com/users/xiam/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":2,"state":"open","created_at":"2015-05-12T16:36:50Z","updated_at":"2015-07-23T01:11:03Z","due_on":"2015-06-09T05:00:00Z","closed_at":null},"comments":3,"created_at":"2015-05-26T16:52:55Z","updated_at":"2015-08-02T12:53:44Z","closed_at":null,"body":"In the specific adapters, a call to `Collection()` and `Collections()` will query the database for the table details. However, since `conn.Collection(\"...\")` is called so often and shouldn't change at runtime, we should cache the db.Collection returns.\r\n\r\nAlso, what is the use case for accepting an array of names? Is this for joins? if so, we should consider how should join's be done in general to see if this is the right place for it."},"comment":{"url":"https://api.github.com/repos/upper/db/issues/comments/127022648","html_url":"https://github.com/upper/db/issues/80#issuecomment-127022648","issue_url":"https://api.github.com/repos/upper/db/issues/80","id":127022648,"user":{"login":"xiam","id":385670,"avatar_url":"https://avatars.githubusercontent.com/u/385670?v=3","gravatar_id":"","url":"https://api.github.com/users/xiam","html_url":"https://github.com/xiam","followers_url":"https://api.github.com/users/xiam/followers","following_url":"https://api.github.com/users/xiam/following{/other_user}","gists_url":"https://api.github.com/users/xiam/gists{/gist_id}","starred_url":"https://api.github.com/users/xiam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiam/subscriptions","organizations_url":"https://api.github.com/users/xiam/orgs","repos_url":"https://api.github.com/users/xiam/repos","events_url":"https://api.github.com/users/xiam/events{/privacy}","received_events_url":"https://api.github.com/users/xiam/received_events","type":"User","site_admin":false},"created_at":"2015-08-02T12:53:44Z","updated_at":"2015-08-02T12:53:44Z","body":"Looks like caching just the database schema and not the collection pointer currently provides good results when using the `Collection()` method:\r\n\r\n```\r\nPASS\r\nBenchmarkUpperGetCollection      3000000               497 ns/op\r\nok      upper.io/db/postgresql  2.275s\r\n```\r\n\r\nexcept in MongoDB on which I am caching the collection value. That didn't provide a significant speed bump because `Collection()` still needed to check whether the collection exists or not.\r\n\r\nCaching the `C()` method provided awesome results on all SQL and MongoDB databases. "}}