Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
ソーシャルゲームDBの危機回避
Search
Ryosuke Suto
December 12, 2014
Technology
10
14k
ソーシャルゲームDBの 危機回避
MySQL Casual Talks vol.7
Ryosuke Suto
December 12, 2014
Tweet
Share
More Decks by Ryosuke Suto
See All by Ryosuke Suto
横断的なSRE推進と成熟度評価
strsk8
9
7.4k
GKEを利用したサービスの運用
strsk8
1
590
パブリック/プライベートクラウドでつかうKubernetes
strsk8
1
2.3k
GKE@AbemaTV
strsk8
12
9.2k
re:Invent2015参加レポ
strsk8
0
270
成長し続けるインフラの安定運用事情
strsk8
19
5.1k
Other Decks in Technology
See All in Technology
[Ruby] Develop a Morse Code Learning Gem & Beep from Strings
oguressive
1
150
サーバレスアプリ開発者向けアップデートをキャッチアップしてきた #AWSreInvent #regrowth_fuk
drumnistnakano
0
190
10個のフィルタをAXI4-Streamでつなげてみた
marsee101
0
160
PHP ユーザのための OpenTelemetry 入門 / phpcon2024-opentelemetry
shin1x1
1
170
あの日俺達が夢見たサーバレスアーキテクチャ/the-serverless-architecture-we-dreamed-of
tomoki10
0
430
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
podman_update_2024-12
orimanabu
1
260
ゼロから創る横断SREチーム 挑戦と進化の軌跡
rvirus0817
2
260
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
520
Wvlet: A New Flow-Style Query Language For Functional Data Modeling and Interactive Data Analysis - Trino Summit 2024
xerial
1
110
【re:Invent 2024 アプデ】 Prompt Routing の紹介
champ
0
140
Snowflake女子会#3 Snowpipeの良さを5分で語るよ
lana2548
0
230
Featured
See All Featured
Into the Great Unknown - MozCon
thekraken
33
1.5k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Optimizing for Happiness
mojombo
376
70k
The Cult of Friendly URLs
andyhume
78
6.1k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Site-Speed That Sticks
csswizardry
2
190
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Designing Experiences People Love
moore
138
23k
Facilitating Awesome Meetings
lara
50
6.1k
Gamification - CAS2011
davidbonilla
80
5.1k
Producing Creativity
orderedlist
PRO
341
39k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Transcript
CyberAgent, Inc. Ryosuke Suto ιʔγϟϧήʔϜ%#ͷ ةػճආ MySQL Casual
Talks vol.7 2014/12/07
$ZCFS"HFOU *OD ΞδΣϯμ ࣗݾհ σΟεΫ༰ྔͷةػΛճආ͢Δ ϨϓϦԆͷةػΛճආ͢Δ
ਢ౻ྋհʢ͢ͱ͏Γΐ͏͚͢ʣ @strsk גࣜձࣾαΠόʔΤʔδΣϯτ ΠϯϑϥˍίΞςΫຊ෦ ISUCON4 ༧બഊୀ $ZCFS"HFOU *OD
$ZCFS"HFOU *OD σΟεΫ༰ྔͷةػΛճආ͢Δ
$ZCFS"HFOU *OD
$ZCFS"HFOU *OD ΪϑτϘοΫεͱ ΧʔυҰཡͷ্ঢ͕Ϡό͍ • OͷσʔλͰ৽ँ͕ܹ͍͠ • ཤྺදࣔௐࠪͷͨΊɺҰఆظؒͷσʔλඞཁ •
ΠϕϯτͷϐʔΫ࣌े(#%BZ૿͑Δ͜ͱ • ཧআͨ͠··Ͱͯ͠ͳ͔ͬͨΓʜ
6 CyberAgent, Inc. Ϡό͍ʂʂʂ
$ZCFS"HFOU *OD ͬͨ͜ͱ • ཧআ͞Ε͍ͯΔɺҰఆظؒܦͬͨσʔλΛআ • আྔ͕ଟ͗͢ΔͷͰϝϯςϯε࣮ࢪ • */4&35*/504&-&$5ͱ3&/".&Ͱ࡞Γͳ
͓͢ • σʔλআόονΛͭͬͯ͘ఆظతʹআ
$ZCFS"HFOU *OD CREATE TABLE giftbox_new LIKE giftbox; INSERT INTO
giftbox_new SELECT giftbox WHERE (status = 1 AND updated > ‘2014-11-07 00:00:00’) OR (status = 0); RENAME giftbox giftbox_bk, giftbox_new giftbox; DROP TABLE giftbox_bk;
$ZCFS"HFOU *OD %&-&5&ͯ͠ ۭ͖༰ྔ͕૿͑ͳ͍ • IUUQOJQQPOEBOKJCMPHTQPUKQ JOOPECIUNM • %&-&5&ͯ͠আ͞ΕͨϚʔΫ͕͞ΕΔ͚ͩͰ༰
ྔݮΒͳ͍ • 015*.*;&͢ΔͨΊʹQUPTDΛ͔ͭ͏
$ZCFS"HFOU *OD $ pt-online-schema-change –-execute --alter=“engine=InnoDB” h=localhost,D=db_name,t=giftbox,u=root Α͔ͭ͘͏Φϓγϣϯ TFUWBSTlTRM@MPH@CJOzʜϨϓϦͤͨ͘͞ͳ͍࣌
DSJUJDBMMPBEʜεϨου͕͜ΕΛ͑Δͱதஅ NBYMPBEʜεϨου͕͜ΕΛ͑ΔͱҰ࣌ఀࢭ
$ZCFS"HFOU *OD ةػճආʂ
12 CyberAgent, Inc. ةػճආʂʂʂ
$ZCFS"HFOU *OD ϨϓϦԆͷةػΛճආ͢Δ
$ZCFS"HFOU *OD 536/$"5&ͨ͠ΒԆ • ήʔϜͷϚελσʔλ͕ຖճσʔλΛΫϦΞͯ͠ ಡΈࠐΉελΠϧ • ςʔϒϧΛ536/$"5&ͯ͠Δ෦ͰԆ͕ ൃੜ͍ͯ͠Δ
• %&-&5&͢ΔΑΓ͍
$ZCFS"HFOU *OD খ͍͞ςʔϒϧͰ͍ • ༰ྔ.#ɺ ߦ • 536/$"5&TFD •
%&-&5&TFD
16 CyberAgent, Inc. ͍ʂʂʂ
$ZCFS"HFOU *OD όάͩͬͨ • IUUQXXXQFSDPOBDPNCMPH QFSGPSNBODFQSPCMFNXJUIJOOPECBOEESPQ UBCMF • 536/$"5&は%301$3&"5&
• lJOOPEC@pMF@QFS@UBCMFzͰ%301࣌ͷόά • όοϑΝϓʔϧͷར༻ྔ͕େ͖͍΄Ͳ͘ͳΔ
$ZCFS"HFOU *OD %&-&5&ʹͯ͠Ԇճආ • σʔλྔ͕ଟ͍ͱ%&-&5&Ͱ͘ͳΔ • εϨʔϒˠϚελʔͷॱͰ࣮ߦͯ͠ճආ Slave> DELETE
FROM masterdata; Master> DELETE FROM masterdata; Master> INSET INTO masterdata (hoge,fuga,…) VALUES (xxx,yyy,…); ʢུʣ
19 CyberAgent, Inc. ةػճආʂʂʂ