{"action":"opened","number":280,"pull_request":{"url":"https://api.github.com/repos/sgrif/diesel/pulls/280","id":66786236,"html_url":"https://github.com/sgrif/diesel/pull/280","diff_url":"https://github.com/sgrif/diesel/pull/280.diff","patch_url":"https://github.com/sgrif/diesel/pull/280.patch","issue_url":"https://api.github.com/repos/sgrif/diesel/issues/280","number":280,"state":"open","locked":false,"title":"Implement prepared statement caching for PG","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"body":"The overall structure is somewhat similar to that for SQLite. I have a\r\nfew issues with the implementation, but all of them point to some larger\r\nissues with the pg::connection module and I feel that they're outside of\r\nthe scope of this PR. In particular, I don't like how much\r\n`RawConnection` needed to leak for this to be factored well. That struct\r\nlives at a really weird layer of abstraction, to the point that I'm\r\nunsure it should exist at all. I need to give the pg module an update,\r\nas it's full of warts from before `Connection` was generic. That will be\r\ndone as a separate PR.\r\n\r\nI think there's a common ground between how we implemented this for\r\nSQLite and how we implemented this for PG that I want to eventually\r\nrefactor both towards. This may even result in sufficiently generic code\r\nthat we can make it part of the `Connection` trait to make this easier\r\nfor third party adapters to hook into.\r\n\r\nOnce again, this results in a healthy performance boost across the\r\nboard.\r\n\r\n```\r\nname                                                      old ns/iter  new ns/iter    diff ns/iter   diff %\r\nbench_selecting_0_rows_with_medium_complex_query          223,674      119,463            -104,211  -46.59%\r\nbench_selecting_0_rows_with_trivial_query                 77,281       51,273              -26,008  -33.65%\r\nbench_selecting_10k_rows_with_medium_complex_query        57,555,386   55,233,745       -2,321,641   -4.03%\r\nbench_selecting_10k_rows_with_medium_complex_query_boxed  58,937,340   54,434,717       -4,502,623   -7.64%\r\nbench_selecting_10k_rows_with_trivial_query               4,739,991    4,559,375          -180,616   -3.81%\r\nbench_selecting_10k_rows_with_trivial_query_boxed         4,610,084    4,466,172          -143,912   -3.12%\r\n```","created_at":"2016-04-18T00:00:01Z","updated_at":"2016-04-18T00:00:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sgrif/diesel/pulls/280/commits","review_comments_url":"https://api.github.com/repos/sgrif/diesel/pulls/280/comments","review_comment_url":"https://api.github.com/repos/sgrif/diesel/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sgrif/diesel/issues/280/comments","statuses_url":"https://api.github.com/repos/sgrif/diesel/statuses/9a36ddd2238b5dd3109ab8835c0676f53b608398","head":{"label":"sgrif:sg-prepared-statements-pg","ref":"sg-prepared-statements-pg","sha":"9a36ddd2238b5dd3109ab8835c0676f53b608398","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"repo":{"id":41609775,"name":"diesel","full_name":"sgrif/diesel","owner":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sgrif/diesel","description":"A safe, extensible ORM and Query Builder for Rust","fork":false,"url":"https://api.github.com/repos/sgrif/diesel","forks_url":"https://api.github.com/repos/sgrif/diesel/forks","keys_url":"https://api.github.com/repos/sgrif/diesel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgrif/diesel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgrif/diesel/teams","hooks_url":"https://api.github.com/repos/sgrif/diesel/hooks","issue_events_url":"https://api.github.com/repos/sgrif/diesel/issues/events{/number}","events_url":"https://api.github.com/repos/sgrif/diesel/events","assignees_url":"https://api.github.com/repos/sgrif/diesel/assignees{/user}","branches_url":"https://api.github.com/repos/sgrif/diesel/branches{/branch}","tags_url":"https://api.github.com/repos/sgrif/diesel/tags","blobs_url":"https://api.github.com/repos/sgrif/diesel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgrif/diesel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgrif/diesel/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgrif/diesel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgrif/diesel/statuses/{sha}","languages_url":"https://api.github.com/repos/sgrif/diesel/languages","stargazers_url":"https://api.github.com/repos/sgrif/diesel/stargazers","contributors_url":"https://api.github.com/repos/sgrif/diesel/contributors","subscribers_url":"https://api.github.com/repos/sgrif/diesel/subscribers","subscription_url":"https://api.github.com/repos/sgrif/diesel/subscription","commits_url":"https://api.github.com/repos/sgrif/diesel/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgrif/diesel/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgrif/diesel/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgrif/diesel/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgrif/diesel/contents/{+path}","compare_url":"https://api.github.com/repos/sgrif/diesel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgrif/diesel/merges","archive_url":"https://api.github.com/repos/sgrif/diesel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgrif/diesel/downloads","issues_url":"https://api.github.com/repos/sgrif/diesel/issues{/number}","pulls_url":"https://api.github.com/repos/sgrif/diesel/pulls{/number}","milestones_url":"https://api.github.com/repos/sgrif/diesel/milestones{/number}","notifications_url":"https://api.github.com/repos/sgrif/diesel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgrif/diesel/labels{/name}","releases_url":"https://api.github.com/repos/sgrif/diesel/releases{/id}","deployments_url":"https://api.github.com/repos/sgrif/diesel/deployments","created_at":"2015-08-29T22:51:00Z","updated_at":"2016-04-17T14:14:35Z","pushed_at":"2016-04-18T00:00:01Z","git_url":"git://github.com/sgrif/diesel.git","ssh_url":"git@github.com:sgrif/diesel.git","clone_url":"https://github.com/sgrif/diesel.git","svn_url":"https://github.com/sgrif/diesel","homepage":"","size":4867,"stargazers_count":799,"watchers_count":799,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"open_issues_count":28,"forks":49,"open_issues":28,"watchers":799,"default_branch":"master"}},"base":{"label":"sgrif:master","ref":"master","sha":"396b9bbc97fcd5f17712df2334bd09c8df0d6c55","user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"repo":{"id":41609775,"name":"diesel","full_name":"sgrif/diesel","owner":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sgrif/diesel","description":"A safe, extensible ORM and Query Builder for Rust","fork":false,"url":"https://api.github.com/repos/sgrif/diesel","forks_url":"https://api.github.com/repos/sgrif/diesel/forks","keys_url":"https://api.github.com/repos/sgrif/diesel/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sgrif/diesel/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sgrif/diesel/teams","hooks_url":"https://api.github.com/repos/sgrif/diesel/hooks","issue_events_url":"https://api.github.com/repos/sgrif/diesel/issues/events{/number}","events_url":"https://api.github.com/repos/sgrif/diesel/events","assignees_url":"https://api.github.com/repos/sgrif/diesel/assignees{/user}","branches_url":"https://api.github.com/repos/sgrif/diesel/branches{/branch}","tags_url":"https://api.github.com/repos/sgrif/diesel/tags","blobs_url":"https://api.github.com/repos/sgrif/diesel/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sgrif/diesel/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sgrif/diesel/git/refs{/sha}","trees_url":"https://api.github.com/repos/sgrif/diesel/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sgrif/diesel/statuses/{sha}","languages_url":"https://api.github.com/repos/sgrif/diesel/languages","stargazers_url":"https://api.github.com/repos/sgrif/diesel/stargazers","contributors_url":"https://api.github.com/repos/sgrif/diesel/contributors","subscribers_url":"https://api.github.com/repos/sgrif/diesel/subscribers","subscription_url":"https://api.github.com/repos/sgrif/diesel/subscription","commits_url":"https://api.github.com/repos/sgrif/diesel/commits{/sha}","git_commits_url":"https://api.github.com/repos/sgrif/diesel/git/commits{/sha}","comments_url":"https://api.github.com/repos/sgrif/diesel/comments{/number}","issue_comment_url":"https://api.github.com/repos/sgrif/diesel/issues/comments{/number}","contents_url":"https://api.github.com/repos/sgrif/diesel/contents/{+path}","compare_url":"https://api.github.com/repos/sgrif/diesel/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sgrif/diesel/merges","archive_url":"https://api.github.com/repos/sgrif/diesel/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sgrif/diesel/downloads","issues_url":"https://api.github.com/repos/sgrif/diesel/issues{/number}","pulls_url":"https://api.github.com/repos/sgrif/diesel/pulls{/number}","milestones_url":"https://api.github.com/repos/sgrif/diesel/milestones{/number}","notifications_url":"https://api.github.com/repos/sgrif/diesel/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sgrif/diesel/labels{/name}","releases_url":"https://api.github.com/repos/sgrif/diesel/releases{/id}","deployments_url":"https://api.github.com/repos/sgrif/diesel/deployments","created_at":"2015-08-29T22:51:00Z","updated_at":"2016-04-17T14:14:35Z","pushed_at":"2016-04-18T00:00:01Z","git_url":"git://github.com/sgrif/diesel.git","ssh_url":"git@github.com:sgrif/diesel.git","clone_url":"https://github.com/sgrif/diesel.git","svn_url":"https://github.com/sgrif/diesel","homepage":"","size":4867,"stargazers_count":799,"watchers_count":799,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":49,"mirror_url":null,"open_issues_count":28,"forks":49,"open_issues":28,"watchers":799,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sgrif/diesel/pulls/280"},"html":{"href":"https://github.com/sgrif/diesel/pull/280"},"issue":{"href":"https://api.github.com/repos/sgrif/diesel/issues/280"},"comments":{"href":"https://api.github.com/repos/sgrif/diesel/issues/280/comments"},"review_comments":{"href":"https://api.github.com/repos/sgrif/diesel/pulls/280/comments"},"review_comment":{"href":"https://api.github.com/repos/sgrif/diesel/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sgrif/diesel/pulls/280/commits"},"statuses":{"href":"https://api.github.com/repos/sgrif/diesel/statuses/9a36ddd2238b5dd3109ab8835c0676f53b608398"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":313,"deletions":50,"changed_files":5}}