{"action":"created","issue":{"url":"https://api.github.com/repos/slick/slick/issues/1155","labels_url":"https://api.github.com/repos/slick/slick/issues/1155/labels{/name}","comments_url":"https://api.github.com/repos/slick/slick/issues/1155/comments","events_url":"https://api.github.com/repos/slick/slick/issues/1155/events","html_url":"https://github.com/slick/slick/issues/1155","id":85503522,"number":1155,"title":"Compiled Queries are a huge pain","user":{"login":"schmitch","id":1641401,"avatar_url":"https://avatars.githubusercontent.com/u/1641401?v=3","gravatar_id":"","url":"https://api.github.com/users/schmitch","html_url":"https://github.com/schmitch","followers_url":"https://api.github.com/users/schmitch/followers","following_url":"https://api.github.com/users/schmitch/following{/other_user}","gists_url":"https://api.github.com/users/schmitch/gists{/gist_id}","starred_url":"https://api.github.com/users/schmitch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/schmitch/subscriptions","organizations_url":"https://api.github.com/users/schmitch/orgs","repos_url":"https://api.github.com/users/schmitch/repos","events_url":"https://api.github.com/users/schmitch/events{/privacy}","received_events_url":"https://api.github.com/users/schmitch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-06-05T10:39:01Z","updated_at":"2015-06-12T15:51:39Z","closed_at":null,"body":"Hello, currently I'm using slick and I try to compile all queries, however I only do this, since the queries are really slow if I won't compiled them, they take a HUGE hit into performance.\r\n\r\nHowever Compiling a query is sometimes really hard and should be improved.\r\nInstead of writing just a simple function like that:\r\n\r\n    db.run(tables.filter(_.id === id).result)\r\n\r\nI need to write the following:\r\n\r\n    db.run(compiledGet(id).result)\r\n    def getQuery(id: Rep[Long]) = tables.filter(_.id === id)\r\n    val compiledGet = Compiled(getQuery _)\r\n\r\nThis is really overly verbose. I think that should definitely improved.\r\n\r\nWithout any improvements it's way easier to just use sql, sqlu and tsql to write any query since they won't need to be compiled and run already really fast. "},"comment":{"url":"https://api.github.com/repos/slick/slick/issues/comments/111533454","html_url":"https://github.com/slick/slick/issues/1155#issuecomment-111533454","issue_url":"https://api.github.com/repos/slick/slick/issues/1155","id":111533454,"user":{"login":"cvogt","id":274947,"avatar_url":"https://avatars.githubusercontent.com/u/274947?v=3","gravatar_id":"","url":"https://api.github.com/users/cvogt","html_url":"https://github.com/cvogt","followers_url":"https://api.github.com/users/cvogt/followers","following_url":"https://api.github.com/users/cvogt/following{/other_user}","gists_url":"https://api.github.com/users/cvogt/gists{/gist_id}","starred_url":"https://api.github.com/users/cvogt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvogt/subscriptions","organizations_url":"https://api.github.com/users/cvogt/orgs","repos_url":"https://api.github.com/users/cvogt/repos","events_url":"https://api.github.com/users/cvogt/events{/privacy}","received_events_url":"https://api.github.com/users/cvogt/received_events","type":"User","site_admin":false},"created_at":"2015-06-12T15:51:39Z","updated_at":"2015-06-12T15:51:39Z","body":"@schmitch Slick's plain SQL interpolation is injection safe. Caching dynamically composed queries can indeed be tricky. You can use the conditions used to determine what query to build as cache keys and e.g. use a mutable Map from key to compiled query as the cache."}}