{"action":"created","issue":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/339","labels_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/339/labels{/name}","comments_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/339/comments","events_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/339/events","html_url":"https://github.com/go-sql-driver/mysql/pull/339","id":75153811,"number":339,"title":"added the multiStatements param to the dsn parameter","user":{"login":"badoet","id":527102,"avatar_url":"https://avatars.githubusercontent.com/u/527102?v=3","gravatar_id":"","url":"https://api.github.com/users/badoet","html_url":"https://github.com/badoet","followers_url":"https://api.github.com/users/badoet/followers","following_url":"https://api.github.com/users/badoet/following{/other_user}","gists_url":"https://api.github.com/users/badoet/gists{/gist_id}","starred_url":"https://api.github.com/users/badoet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/badoet/subscriptions","organizations_url":"https://api.github.com/users/badoet/orgs","repos_url":"https://api.github.com/users/badoet/repos","events_url":"https://api.github.com/users/badoet/events{/privacy}","received_events_url":"https://api.github.com/users/badoet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-05-11T09:32:28Z","updated_at":"2015-05-12T08:51:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/go-sql-driver/mysql/pulls/339","html_url":"https://github.com/go-sql-driver/mysql/pull/339","diff_url":"https://github.com/go-sql-driver/mysql/pull/339.diff","patch_url":"https://github.com/go-sql-driver/mysql/pull/339.patch"},"body":"Add 'multiStatements' param to the dsn string. \r\nmultiStatements is for a batch fire and forget db operations.\r\nthis will help optimize the round trip.\r\nin a transaction, multiple updates through goroutine seems to not run concurrently\r\n\r\n```\r\nUser GoUpdateResource %!s(int64=778018) 64.0037ms\r\nPlayerInventory GoSave %!s(int64=3138) 128.0073ms\r\nUser GoUpdateResource %!s(int64=777805) 189.0108ms\r\nPlayerInventory GoSave %!s(int64=15036) 251.0144ms\r\nPlayerInventory GoSave %!s(int64=15448) 313.0179ms\r\nPlayerInventory GoSave %!s(int64=15655) 375.0214ms\r\nPlayerInventory GoSave %!s(int64=15983) 438.025ms\r\nPlayerInventory GoSave %!s(int64=16656) 500.0286ms\r\nPlayerInventory GoSave %!s(int64=3160) 564.0322ms\r\nPlayerInventory GoSave %!s(int64=15034) 629.036ms\r\nPlayerInventory GoSave %!s(int64=3162) 690.0394ms\r\nPlayerInventory GoSave %!s(int64=16759) 753.043ms\r\nPlayerInventory GoSave %!s(int64=9061) 817.0467ms\r\nPlayerInventory GoSave %!s(int64=15037) 881.0504ms\r\nPlayerInventory GoSave %!s(int64=15291) 944.054ms\r\nPlayerInventory GoSave %!s(int64=15038) 1.0080576s\r\nPlayerInventory GoSave %!s(int64=15039) 1.0700612s\r\nPlayerInventory GoSave %!s(int64=15391) 1.1340648s\r\nPlayerInventory GoSave %!s(int64=15390) 1.1970684s\r\nPlayerInventory GoSave %!s(int64=16393) 1.259072s\r\nPlayerInventory GoSave %!s(int64=14719) 1.3230756s\r\nPlayerInventory GoSave %!s(int64=16256) 1.3870793s\r\nPlayerInventory GoSave %!s(int64=15033) 1.4500829s\r\nPlayerInventory GoSave %!s(int64=16279) 1.5130865s\r\nPlayerInventory GoSave %!s(int64=16658) 1.5750901s\r\nPlayerInventory GoSave %!s(int64=16335) 1.6390937s\r\nPlayerInventory GoSave %!s(int64=16645) 1.7020973s\r\nPlayerInventory GoSave %!s(int64=16654) 1.7641009s\r\nPlayerInventory GoSave %!s(int64=16385) 1.8271045s\r\nPlayerInventory GoSave %!s(int64=16287) 1.889108s\r\nPlayerInventory GoSave %!s(int64=15670) 1.9511116s\r\nPlayerInventory GoSave %!s(int64=16363) 2.0151152s\r\nPlayerInventory GoSave %!s(int64=15694) 2.0791189s\r\nPlayerInventory GoSave %!s(int64=16297) 2.1411224s\r\nPlayerInventory GoSave %!s(int64=16263) 2.2051261s\r\nPlayerInventory GoSave %!s(int64=15965) 2.2681297s\r\nPlayerInventory GoSave %!s(int64=16200) 2.3311333s\r\nPlayerInventory GoSave %!s(int64=16306) 2.395137s\r\nPlayerInventory GoSave %!s(int64=16310) 2.4591406s\r\nPlayerInventory GoSave %!s(int64=16666) 2.5211442s\r\nPlayerInventory GoSave %!s(int64=16839) 2.5851478s\r\nPlayerInventory GoSave %!s(int64=15044) 2.6471514s\r\ngoroutine done 2.6471514s\r\ntx.Commit() 65.0037ms\r\n```\r\n\r\nLimitations: \r\nn, _ := res.RowsAffected()\r\nn will return 1 instead of the x number of rows updated in the batch query\r\n\r\ntested with gocraft/dbr works as intended "},"comment":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/comments/101194786","html_url":"https://github.com/go-sql-driver/mysql/pull/339#issuecomment-101194786","issue_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/339","id":101194786,"user":{"login":"arnehormann","id":1011413,"avatar_url":"https://avatars.githubusercontent.com/u/1011413?v=3","gravatar_id":"","url":"https://api.github.com/users/arnehormann","html_url":"https://github.com/arnehormann","followers_url":"https://api.github.com/users/arnehormann/followers","following_url":"https://api.github.com/users/arnehormann/following{/other_user}","gists_url":"https://api.github.com/users/arnehormann/gists{/gist_id}","starred_url":"https://api.github.com/users/arnehormann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnehormann/subscriptions","organizations_url":"https://api.github.com/users/arnehormann/orgs","repos_url":"https://api.github.com/users/arnehormann/repos","events_url":"https://api.github.com/users/arnehormann/events{/privacy}","received_events_url":"https://api.github.com/users/arnehormann/received_events","type":"User","site_admin":false},"created_at":"2015-05-12T08:51:34Z","updated_at":"2015-05-12T08:51:34Z","body":"@badoet maybe we deviated with interpolateParams - but if so, we did it in a way that's never confusing and fully enables it as a feature. Whatever we do with stored procedures, they won't work in a database/sql/driver compatible way without some unavailable features and strange corner cases requiring deeper knowledge of MySQL internals.\r\nI also dislike adding new dsn parameters. If this gets in, it should be configurable so it is less confusing when it fails."}}