Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
MySQL 㨠Unicode Collation Algorithm (UCA) - ãã¿ã½ãã¼ã ã«é¢é£ãããããã¯ã§ã MySQL ã«ã¯å¯¿å¸ãã¼ã«åé¡ã¨ããã®ãããã 寿å¸ãã¼ã«åé¡ã©ã£ãã§è©³ããã話ãèãã¹ãã ããªããããâ RKajiyama (@RKajiyama) March 18, 2015 ããã¯ã©ãããåé¡ãã¨ããã¨ã MySQL ã® Unicode ã§ã¯ binary collation ã«ãã¦ã³ã¼ããã¤ã³ãã§æ¯è¼ããªãã¨ð£ã¨ðºã«éããçµµæåãåå¤å¤å®ãããã¨ããåé¡ã§ãã ããï¼ MySQL ã® utf8mb4 charset ã£ã¦ã4ãã¤ãæåå士ãæ¯è¼ããã¨åãæåæ±ããããï¼ SELECT 'ð£'='ðº' â 1 MySQLçã«ã¯å¯¿å¸ã¨ãã¼ã«ã¯åãæ±ããâ ã¨ã¿ãã¾ãã²ã (@tmtms) December 22, 2014 MySQL㧠select
DDLã¨ãã¼ã¿ã¯æ«å°¾ã«ç¤ºãã¾ãããè¤åã¤ã³ããã¯ã¹ãå¹ãã¯ãã®ã¯ã¨ãªãªãã ãã©ããã¦ãè¡æ°ãå¤ãã¦å°ã£ãã¨ããã話ã§ãã(MySQL 5.1.55) ãã®ã¯ã¨ãªã§è¿ã£ã¦ããè¡æ°ã¯246件ãªãã§ãããããã«ãã¦ã¯ããã¦ãè¡æ°(rows)ããããå¤ãã§ããwhereå¥ã§ä½¿ã£ã¦ããageã¨last_updateã¨ã§è¤åã¤ã³ããã¯ã¹ãå¼µã£ã¦ããã®ã«ãã§ãã between使ç¨: explain extended select id from betweeeeen where age between 30 and 35 and last_update >= 946612000 \G â id: 1 select_type: SIMPLE table: betweeeeen type: range possible_keys: i1 key: i1 key_len: 10 ref: NULL rows
å»å¹´ã½ã¼ãã«é¢ããè¨äºãæ¸ããããä»æ¥ã¯ãã®ç¶ãã§ããã MySQLã§EXPLAIN SELECT...ãå®è¡ããã¨Extraãã£ã¼ã«ãã§ããè¦ããããUsing filesortãã¨ããæååãFilesortã£ã¦ä¸ä½ãªãã ããï¼ã¨æã£ããã¨ã¯ãªãã ããããååç´å ¥ã«è¨ã£ã¦Filesortã®æ£ä½ã¯ã¯ã¤ãã¯ã½ã¼ãã§ããã ã¯ã¨ãªã«ORDER BYãå«ã¾ããå ´åãMySQLã¯ããç¨åº¦ã®å¤§ããã¾ã§ã¯å ¨ã¦ã¡ã¢ãªå ã§ã¯ã¤ãã¯ã½ã¼ããå¦çãããããç¨åº¦ã®å¤§ããã¨ã¯sort_buffer_sizeã§ãããããã¯ã»ãã·ã§ã³ãã¨ã«å¤æ´å¯è½ã§ãããã½ã¼ãã«å¿ è¦ãªã¡ã¢ãªãsort_buffer_sizeãã大ãããªãã¨ããã³ãã©ãªãã¡ã¤ã«ï¼ãã³ãã©ãªãã¼ãã«ã§ã¯ãªãï¼ãä½æãããã¡ã¢ãªã¨ãã¡ã¤ã«ãä½µç¨ãã¦ã¯ã¤ãã¯ã½ã¼ããå®è¡ãããã Filesortã¯å ¨ã¦ã®ã½ã¼ãå¦çã«ããã¦å®è¡ãããããã§ã¯ãªããååã®è¨äº
ãã®è¨äºã«ã¯ç¶ããããã¾ã ã°ã«ã¼ãå ã®ä¸ä½ N 件ãæ½åºãã SQL ã¯ã¹ãã¢ãã§ããããããªãï¼ - ngã®æ¥è¨ MySQL ã§ç°¡åã«åºæ¥ããã§åºæ¥ãªã SQL ã«ãã°ã«ã¼ãå ã®ä¸ä½ N 件ãæ½åºãã SQLããããã¾ããå¹´ã« 1 åããããã®åé¡ã«ã¤ãã¦èããæ¯ååãçµè«ã«ãªããããã¼å»å¹´ãåããã¨èããæ°ããããªã¼ãã¨ãªã£ã¦ããã®ã§ãæ¥å¹´ãåããã¨ãèããã§ãããèªåã«åãã¦ã¡ã¢ãæ®ãã¦ããã¾ãã ãªãããã®å 容㯠MySQL 5.5.19 ã§è©¦ãã¦ãã¾ã*1ã (2012/07/26 追è¨ï¼ãã¹ããã¼ã¿ãå¢ããããusers ã® name ãæ½åºããã¦ããªãã®ãä¿®æ£) ãã¹ããã¼ã¿ drop table if exists groups; drop table if exists users; create table groups ( gid int not null prim
I'm just starting out with Ruby (and rails). I did the setup according to http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:ruby gems, using rvm. I have everything working well with sqlite. Now I'd like to try converting things over to MySQL, since that's what I do most of my development with. In my Gemfile I've replaced sqlite with mysql2: group :development, :test do # gem 'sqlite3',
MySQL Bug #79977 "utf8mb4_unicode_520_ci don't make sense for Japanese FTS" ã§è¨ãããã㨠è±èªã§æ¸ãã¦ããèªåã§ãããããããªããªã£ã¦ããã®ã§ã MySQL Bugs: #79977: utf8mb4_unicode_520_ci don't make sense for Japanese FTS * æ¬è³ªçã«ã¯Â MySQL Bugs: #76553: Sushi-Beer issue of MySQL with utf8mb4 ã®é¢é£ã * Unicodeå®è£ ãä¸å®å ¨ã ããèµ·ãã£ã¦ããåé¡ã * 丸ãåé¡ * motherãæå³ããæ¸ãæ¹ã«ãã¯ã¯ï¼ã²ãããªï¼ã¨ããï¼ã«ã¿ã«ãï¼ã¨ï¾ï¾ï¼åè§ã«ã¿ã«ãï¼ããã£ã¦ã * ãããã¯ï¼æåã®å½¢ã¯éããã©ï¼åãé³ã§åãæå³ã ããã大æ¦ã®å ´ååãæåã¨ãã¦æ±ã£ã¦ãããã¨å¬ããã
7. ã®ã£ããããã¯ããã 空éã®INSERTã¯æ¢ã¾ã 5 6 10 id (pk) tx A tx B SELECT * FROM t WHERE id = 4 FOR UPDATE BEGIN BEGIN INSERT INTO t (id) VALUES (1); ãããã¯ããã id=2,3,4ãåæ§ã«ããã㯠id=7ã¨ãã¯ãããã¯ãããªã 7 8. ã®ã£ããããã¯å士㯠ãããã¯ããªã 5 6 10 id (pk) tx A tx B SELECT * FROM t WHERE id = 4 FOR UPDATE BEGIN BEGIN SELECT * FROM t WHERE id = 3 FOR UPDATE INSERT INTO t (id) VALUES(4) INSERT INTO t (id) VALUES(3) åãã®ã£ãã空éã ãã©æ¢ã¾ããªã Deadloc
ã¯ããã« ã¤ãã«AdventCalenderãï¼æ¥ã§ããã MySQL Casual Advent Calendar24æ¥ç®ã®æ å½ã®@gotyooooã§ãã æ¨æ¥ã¯@kuwa_twããã®ã·ã§ã«ã¹ã¯ãªããã ãã§MySQLããMongoDBã¸ã®ç§»è¡ãã¡ããã§ããã Mongoã®ã¡ã¢ãªé£ãã¾ãããªä»æ§ãæ°ã«ãªã£ã¦ã¾ãã»ã»ã»ãRDBãããã¼ï½ MySQLçéã§ã¯ãã£ã±ãMariaDBã¯RHEL7ã¨ãã§æ¨æºã«ãªã£ããã¨ãç±ãã§ããããé©å½ãªãã®ã§ã¾ãã¯è©¦ãã¦ã¿ããã§ããGalera clusterã£ã¦ãããã°ã©ããªã£ããã ãã»ã»ã»ã æ¬æ¥ã®å 容 æ¨é¡ã®éãã§ããä»æ´ãªãã5.5ãã5.6ã«ç§»è¡ãããã¼ã¿ãã¼ã¹ã§ICPã«ããåé¡ãèµ·ãã£ã¦ãã¾ãã¾ããããã®ãã¨ãæ¸ããã¨æãã¾ãã ICP(Index Condition Pushdown)ã¨ã¯ï¼ 5.6ã®æ°æ©è½ ããã©ã«ãON ç°¡åã«æ©è½èª¬æ ãã«ãã«
ãã©ã³ã¶ã¯ã·ã§ã³ã¨ã¯ 1ã¤ã®ä½æ¥åä½ã¨ãã¦æ±ãããSQLã¯ã¨ãªã®éã¾ãã§ãã è¤æ°ã®UPDATEãINSERTãã²ã¨ã¤ã®éã¾ãã¨ãã¦ã ãããã®ã¯ã¨ãªããã¹ã¦é©ç¨ã§ããå ´åã®ã¿ãã¼ã¿ãã¼ã¹ã«åæ ãã¾ãã ã²ã¨ã¤ã§ãé©ç¨ã«å¤±æããã¯ã¨ãªããã£ãå ´åã¯ããã®ã¾ã¨ã¾ããã¹ã¦ã®ã¯ã¨ãªã®çµæã¯åæ ãã¾ããã ACIDç¹æ§ ãã©ã³ã¶ã¯ã·ã§ã³å¦çã«æ±ãããã4ã¤ã®ç¹æ§ã§ãã ååæ§ (Atomicity) ãã©ã³ã¶ã¯ã·ã§ã³ã«å«ã¾ããæé ãããã¹ã¦å®è¡ãããããããã¹ã¦ãããªãããã®ã©ã¡ããã«ãªãæ§è³ªã ä¸è²«æ§ (Consistency) ã©ããªç¶æ³ã§ããã©ã³ã¶ã¯ã·ã§ã³åå¾ã§ãã¼ã¿ã®æ´åæ§ãçç¾ãªãä¿ãããæ§è³ªã åé¢æ§ (Isolation) ãã©ã³ã¶ã¯ã·ã§ã³å®è¡ä¸ã¯ãå¦çéä¸ã®ãã¼ã¿ã¯å¤é¨ããé è½ããã¦ä»ã®å¦çã«å½±é¿ãä¸ããªãæ§è³ªã æ°¸ç¶æ§ (Durability) ãã©ã³ã¶ã¯ã·ã§ã³ãå®äºããããã·ã¹
ããããã°å æ¥ã¯ããã¦ã£ã³ã ã£ããããã§ãä»æ¥ã¹ã¿ãã«è¡ã£ã¦ã¿ããæ©ããã¯ãªã¹ãã¹ä»æ§ãæ®å¿µãªããå¹´æ«ã®äºå®ã¯ç¡ãã ãããªãããªã§ãªã³ã©ã¤ã³ã¹ãã¼ããã§ã³ã¸ãæ¬çªã®ãªãã¬ã¼ã·ã§ã³ã§ä½¿ãå§ããã®ã§ãã®ã¡ã¢ã 0. online-schema-change ãªã³ã©ã¤ã³ã¹ãã¼ããã§ã³ã¸ã¯ãpercona社ãåºãã¦ããpercona-toolkitã«æ¢±å ããã¦ããããã®ä»æç¨ãªãã¼ã«ãå ¥ã£ã¦ããã®ã§ãä¸è©±ã«ãªã£ã¦ãã人ãå¤ãã ãããã§ããªã³ã©ã¤ã³ã¹ãã¼ããã§ã³ã¸ã¯ãã®åã®ã¨ãããã¹ãã¼ãã®å¤æ´ãalteræããããã¯ãªãã§å®è¡ãã¦ãããã¨ãã代ç©ã ç§äºãªãã ãã©ãä»ã¾ã§ã¯ãã¡ãã£ã¨æ´æ°ããããã¯ãã¡ãããã©ã¢ã¯ã»ã¹ã®å°ãªãæé帯ã«ãªã³ã©ã¤ã³ã§alterãæµããã¿ãããªéç¨ããã¦ããå®è¡å 容ã«ããããã©alter tableã¯æå¤ã¨æ©ãã®ã§ããæ´æ°ããããã¯ãããæéãSLAçã«è¨±å¯ã§ãããªãO
A communication packet is a single SQL statement sent to the MySQL server, a single row that is sent to the client, or a binary log event sent from a replication source server to a replica. The largest possible packet that can be transmitted to or from a MySQL 8.4 server or client is 1GB. When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues an
SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements
ãã®è¨äºã¯MySQL Casual Advent Calendar 2013 3æ¥ç®ã®è¨äºã§ãã ã¯ãã㫠以åã«SELECT ... FOR UPDATEã¨ããã¯ã®æå - walf443's blogã®è¨äºã«Twitterã§å°ãè¨åãããã§ãããããã®è£è¶³ã¨ããããInnoDBã®ããã¯ã®ç¯å²ã«ã¤ãã¦åã¯ããç解ãã¦ãã¾ããã¨ãã話ã§ãã MySQLã¨ããã°ãInnoDBããããã¯ã¼ã¯ãµã¼ãã¨ãã¦ä½¿ãããã®ãã¬ã¼ã ã¯ã¼ã¯ã§ãããSQLã¯InnoDBã®ã¤ã³ããã¯ã¹ã«ã¢ã¯ã»ã¹ããããã®DSLã¨ãã£ã¦ãéè¨ã§ã¯ãªãã§ãããã InnoDBã®ããã¯ã¨ã¯ã¤ã¾ãã¨ããã¤ã³ããã¯ã¹è¡ã®ããã¯ãªã®ã§ãInnoDBã®ããã¯ã®ç¯å²ãç解ããããã«InnoDBã®ã¤ã³ããã¯ã¹ã«ã¤ãã¦å°ãåç½®ããã¦ããã¾ã(ã ãã¶ç«¯æã£ããã©é·ããªã£ãâ¦)ã ã¯ã©ã¹ã¿ã¤ã³ããã¯ã¹ã¨ã»ã«ã³ããªã¤ã³ããã¯ã¹ ãã§ã«InnoDBã®ã¤ã³
MySQLã§ã¹ãã¼ã¯ã¨ãªãã°ãè¨é²ããæ¹æ³ã¯ããã¼ã¸ã§ã³ã«ãã£ã¦è¨å®æ¹æ³ãç°ãªã£ããããªãã·ã§ã³åãå¤æ´ããã¦ãããã¨ãæå¤ã¨åããã¥ãããã¨ãå¤ãã®ã§ããã§ã¾ã¨ãã¦ãããã¨æãã¾ãã ãããã®ãã¼ã¸ã§ã³ã§ããã³ã³ãã£ã°ãã¡ã¤ã«(Linuxã§ã¯ my.cnfãWindowsã§ã¯ my.ini)ã® mysqld ã»ã¯ã·ã§ã³ã«è¨å®ãè¨è¿°ãããã¨ã«ãªãã¾ãã MySQL5.0ã®å ´å MySQL5.0ã®è¨å®æ¹æ³ã¯ç°¡åã§ããlog-slow-queriesãã«ãã°ãåºåãããã¡ã¤ã«åãè¨å®ããã ãã§ãã 絶対ãã¹ã«ããæå®ãå¯è½ã§ãããç¸å¯¾ãã¹ã§æå®ããå ´åã¯ãã¼ã¿ãã£ã¬ã¯ããªããã®ç¸å¯¾ãã¹ã«ãªãã¾ãã ã¾ããã¹ãã¼ã¯ã¨ãªã¨ãã¦è¨é²ãããã¯ã¨ãªã®ãããå¤ãã¤ã¾ãä½ç§ä»¥ä¸ã®ã¯ã¨ãªãã¹ãã¼ã¯ã¨ãªã¨ãã¦ãã°ã«è¨é²ãããã¯ããã©ã«ãã§10ç§ä»¥ä¸ã¨ãªã£ã¦ãã¾ãã ãã®å¤ã¯ãlong_query_timeãã«ã
stop using numbers as IDs. just use UUIDs. seriously â Postgres: The Bits You Havenât Found by pvh UUID ã®éã v1 Generate a UUID from a host ID, sequence number, and the current time. v3 Generate a UUID from the MD5 hash of a namespace UUID and a name. v4 Generate a random UUID v5 Generate a UUID from the SHA-1 hash of a namespace UUID and a name. ãã®å ãID ã¨ãã¦å©ç¨ã§ããã®ã¯ v1 㨠v4 ã®2ã¤ãv1 ã¯æå¾ 48 ãããããã¼ãåºæã®ãã¼
MERGE,UPSERTã¨è¨ããããUPDATEæã¨INSERTæãæ¡ä»¶ã«ãã£ã¦èªåçã«åãæ¿ãããã¨ãã§ããSQLæã¯ãMySQLã§ã¯2種é¡ç¨æããã¦ãã¾ãã REPLACEãINSERT ON DUPLICATE KEY UPDATEã§ãã ããããã®éã㯠REPLACE INSERTæã¨åãæ§æã§INSERTã®é¨åãREPLACEã«ç½®ãæãããã® åä½ã¨ãã¦ã¯é常ã®INSERTã¨åãã§DUPLICATE KEYãçºçããå ´åã«è©²å½ã®ã¬ã³ã¼ããåé¤ãã¦INSERT INSERT ON DUPLICATE KEY UPDATE INSERTæã®ãªãã·ã§ã³ã¨ãã¦è¨è¿° åä½ã¨ãã¦ã¯é常ã®INSERTã¨åãã§DUPLICATE KEYãçºçããå ´åã«ãªãã·ã§ã³ã§æå®ããUPDATEæãå®è¡ REPLACEæã¯æ¶ãããããã¨ããã£ã¦ãç¥ã£ã¦ãã人ãå¤ããã¨æãã¾ãããã¢ããªã±ã¼ã·ã§ã³ã§å®éã«ä½¿
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}