{"id":172796,"date":"2020-10-26T11:57:31","date_gmt":"2020-10-26T03:57:31","guid":{"rendered":"http:\/\/4563.org\/?p=172796"},"modified":"2020-10-26T11:57:31","modified_gmt":"2020-10-26T03:57:31","slug":"%e9%97%ae%e4%b8%aa-sql-%e7%9a%84%e9%97%ae%e9%a2%98%e4%bf%ae%e6%94%b9-%e4%b8%80%e5%bc%a0%e8%a1%a8%e9%9c%80%e8%a6%81%e9%81%bf%e5%85%8d%e5%8f%a6%e4%b8%80%e5%bc%a0%e8%a1%a8%e8%a2%ab%e4%bf%ae%e6%94%b9","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=172796","title":{"rendered":"\u95ee\u4e2a Sql \u7684\u95ee\u9898,\u4fee\u6539 \u4e00\u5f20\u8868\u9700\u8981\u907f\u514d\u53e6\u4e00\u5f20\u8868\u88ab\u4fee\u6539,\u8be5\u600e\u4e48\u5b9e\u73b0\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u95ee\u4e2a Sql \u7684\u95ee\u9898,\u4fee\u6539 \u4e00\u5f20\u8868\u9700\u8981\u907f\u514d\u53e6\u4e00\u5f20\u8868\u88ab\u4fee\u6539,\u8be5\u600e\u4e48\u5b9e\u73b0\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Aruforce <\/span>  <span><i><\/i> 0<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<pre><code>  UPDATE  ab set  pta = x ,  version = version + 1 where  id = x  and 100 = (  select   sum(pta)  from   abf  where   abf.ab_id = x ) <\/code><\/pre>\n<p>\u4e0d\u77e5\u9053 \u4e0a\u9762\u7684 SQL \u662f\u5426\u53ef\u884c\uff1f read commited<\/p>\n<p>\u540e\u9762\u7684 abf \u662f\u5426\u4f1a\u88ab\u9501\u8868\uff1f\u6216\u8005\u8be5\u600e\u4e48\u67e5\u770b\u8fd9\u53e5 SQL \u7684\u6216\u8005\u7ed9\u70b9\u5173\u952e\u5b57 \u4e5f\u884c<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3884512\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Aruforce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6c42\u6551 dalao                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884513\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : wangyanrui <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u731c\u6d4b\u4e0d\u4f1a\uff0c\u8e72\u4e2a\u5927\u4f6c<br \/>\u53e6\uff1a\u6267\u884c\u524d\u4e0a\u4e2a\u9501\u5457                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884514\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : dbolo123 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u60f3\u95ee select for update ?                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884515\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Aruforce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @dbolo123 \u4e0d\u662f select for update \u53ea\u80fd\u9501\u5b9a\u5df2\u5b58\u5728\u7684\u6570\u636e \u5e76\u4e0d\u80fd\u9632\u6b62\u65b0\u589e\u2026\u6211\u662f\u60f3\u907f\u514d\u53e6\u4e00\u5f20\u8868\u88ab\u66f4\u65b0\u2026                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884516\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Leigg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u6761 SQL \u662f\u539f\u5b50\u6267\u884c\uff0c\u4f60\u63d0\u7684\u95ee\u9898\u66b4\u9732\u4f60\u5bf9 mysql \u7684\u751f\u758f\u7a0b\u5ea6                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884517\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : juzi214032 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u53ef\u4ee5\u76f4\u63a5\u5bf9\u53e6\u4e00\u5f20\u8868\u52a0\u9501\uff0clock tables                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884518\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Aruforce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Leigg \u4e00\u53e5 sql \u6267\u884c\u8fc7\u7a0b\u4e2d \uff0c\u8868\u4e5f\u53ef\u80fd\u88ab\u5176\u4ed6\u7684 SQL \u6539\u53d8\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884519\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Aruforce <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @juzi214032 \u8bd5\u8fc7 lock inshare model \uff0c\u5728 RC \u5e76\u4e0d\u80fd\u907f\u514d\u63d2\u5165\u64cd\u4f5c\u3002\u3002\u5728 RR \u5012\u662f\u53ef\u4ee5\u3002\u3002\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3884520\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : juzi214032 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Aruforce \u4e0d\u662f lock inshare model\uff0clock inshare model \u662f\u884c\u7ea7\u9501\uff0c\u4e0d\u662f\u8868\u9501\uff0c\u5f53\u7136\u4e0d\u80fd\u907f\u514d\u63d2\u5165\u64cd\u4f5c\u3002\u7528 LOCK TABLES \u547d\u4ee4\uff0c\u5c31\u662f\u8868\u9501                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u4e2a Sql \u7684\u95ee\u9898,\u4fee\u6539 \u4e00\u5f20\u8868&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172796"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=172796"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/172796\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=172796"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=172796"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=172796"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}