Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MySQLのロックについて(DDL編)

ANDPAD inc
August 18, 2020

 MySQLのロックについて(DDL編)

ANDPAD inc

August 18, 2020
Tweet

More Decks by ANDPAD inc

Other Decks in Technology

Transcript

  1. ͓͞Β͍ w%%- %BUB%FpOJUJPO-BOHVBHF  w $3&"5& %301 "-5&3 536/$"5& w%.-

    %BUB.BOJQVMBUJPO-BOHVBHF  w 4&-&$5 */4&35 61%"5& %&-&5& w%$- %BUB$POUSPM-BOHVBHF  w #&(*/ $0..*5 30--#"$,
  2. վળͷาΈ w .Z42-W w 'BTU*OEFY$SFBUJPO͕αϙʔτ w .Z42-W w ΦϯϥΠϯ%%-͕αϙʔτ w

    ߋ৽ϒϩοΫΛճආՄ w .Z42- w WBSDIBSͷΧϥϜ௕֦ு͕ΦϯϥΠϯରԠ w .Z42- w %%-͕ΞτϛοΫʹ w *OTUBOU"EE$PMVNOͷαϙʔτ
  3. ΦϯϥΠϯ%%- w ΦϯϥΠϯ%%-ɹରԠɾඇରԠ w ˓ΠϯσοΫε௥Ճɾ࡟আɺΧϥϜ௥Ճɾ࡟আ w ºWBSDIBSΧϥϜ௕ͷมߋʢWʣ w ºΧϥϜͷܕͷมߋ w

    -0$,/0/& "-(03*5).*/1-"$&Λ໌ࣔతʹࢦఆ͠ɺ൑ผՄೳ mysql> ALTER TABLE sbtest.sbtest1 MODIFY COLUMN v1 VARCHAR(110), LOCK=NONE, ALGORITHM=INPLACE; ERROR 1846 (0A000): LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED.
  4. w ΦϯϥΠϯͰ%%-Λ࣮ߦ͢Δӡ༻ख๏ w ྲྀΕ  ϨϓϦΧҰ୆ΛαʔϏε͔Β֎͢  TRM@MPH@CJO্ͨ͠Ͱ"-5&3࣮ࢪ  ϨϓϦΧΛαʔϏεʹ໭͢

     શͯͷϨϓϦΧʹ্هΛॱ൪ʹ࣮ࢪ  "-5&3ࡁϨϓϦΧͱϚελʔΛೖΕସ͑Δ  ࠷ޙʹɺچϚελʔʹରͯ͠"-5&3࣮ߦ w ஫ҙ఺ w "84"VSPSBͰ͸ΠϯελϯεؒϨϓϦέʔγϣϯΛར༻͢Δඞཁ͕͋Δ w ϨϓϦΧΛϚελʔʹॠ࣌ʹঢ֨Ͱ͖Δ࢓૊Έ͕ඞཁ w "-5&3࣮ࢪલޙͰϨϓϦέʔγϣϯͷޓ׵ੑΛอͭมߋʹݶΒΕΔ w ˓จࣈྻ௕ͷ֦ுɺςʔϒϧ຤ඌ΁ͷΧϥϜ௥Ճ w ºܕมߋɺΧϥϜ࡟আ 3PMMJOH4DIFNB6QHSBEF  3FQMJDB  3FQMJDB "QQ  .BTUFS "-5&3  3FQMJDB  3FQMJDB "QQ  .BTUFS "-5&3 ࡁ  .BTUFS  3FQMJDB "QQ  3FQMJDB ࡁ ࡁ
  5. w ΦϯϥΠϯͰ%%-Λ࣮ߦ͢Δπʔϧ w ࢓૊Έ  ৽͍͠ఆٛͷςʔϒϧΛ࡞੒  ϩοΫΛ͔͚ͣʹɺݱߦˠ৽ͰσʔλΛͪΐͬͱͣͭίϐʔ  ݱߦςʔϒϧ΁ͷߋ৽͸


    τϦΨʔͰ৽ςʔϒϧ΁࿈ܞ w ஫ҙ఺ w ॻ͖ࠐΈྔ͕̎ഒʹ૿͑Δ w NFUBEBUBMPDL͸ճආͰ͖ͳ͍ QUPOMJOFTDIFNBDIBOHF