Professional Documents
Culture Documents
yS L
\'\
._.
ISBN 978-7-111-42206-8
100037)
ISBN
It' s fair to say that MySQL is the most popular open source database. It has a very large
installed base and number of users. Let' s see what are the reasons MySQL is so popular, where
it stands currently, and maybe touch on some of its future (although predicting the future is rarely
successful).
Looking at the customer area of MySQL, which includes Facebook , Flickr, Adobe (in
Creative Suite Drupal , Linkedln, Wikipedia, eBay, YouTu be, Google AdSense (source
http://mysq l. com/customers/andpublicresources) , it' s obvious that MySQL is everywhere.
When you log in to your popular forum (powered by Bulleting) or blog (powered by WordPress),
most likely it has MySQL as its backend database. Traditionally, two MySQL' s characteristics,
simplicity of use and performance, were what allowed it to gain such popularity. In addition to that,
availability on a range of platforms (including Windows) and built-in replication, which
provides an easy scale-out solution for clients, gave more user attractions and production
deployments. There is simple evidence of MySQL' s simplicity: In 15 minutes or less, you really
can get installed, have a working database, and start running queries and store data. From its early
stages MySQL had a good interface to most popular languages for Web development - PHP and
Perl, and also Java and ODBC connectors.
There are two best known storage engines in MySQL: MyISAM and InnoDB (1 don' t cover
NDB cluster here; it' s a totally different story). MylSAM comes as the default storage engine
and historically it is the oldest, but InnoDB is ACID compliant and provides transactions, row-
level locking , MVCC , automatic recovery and data corruption detection. This makes it the
storage engine you want to choose for your application. Also , there is the third-party transaction
storage engine PBXT, with characteristics similar to InnoDB, which is included in the MariaDB
distribution.
MySQL ' s simplicity has its own drawback. Just as it is to working with it, it is
very easy to start into trouble with it. As soon as your website or forum gets popular, you
may fìgure out that the database is a bottleneck, and that you need special skills and tools to fìx it.
IV
of this
highly recommend new oflnnoDB well who already have well-tuned
InnoDB-based applications but need to get intemal out of them.
Vadim Tkachenko
C...
C:::::J
Different. Think
Different ,
VI
DBA
MySQL
w
buffer
C...
VIII
Peter Vadim
C...
2.5.2 InnoDB
Master Thread.................... ..
2.5.3 Thread
2.6 ……………… 0
1.1 2.6.1 · …………… 46
1.2 …3 2.6.2
1.3
2.6.3
1.3.1 .. ..6
2.6.4 …
.....57
1.3.2 …… ..7
2.6 .5 ………… ........58
1.3 .3
2.7 .. … … …..........58
1.3 .4 … … ...8
2.8
1.3.5
1.3 .6
1.3 .7 · ….................... ..9 3.1
2.3. 1 3.6
!·
4.2 4.8.1
4.2. 1 4.8.2
4.8.3
4.8.4
4.8.5
4.8.6
4.3
4.3.1
4.3.2 5.1
4.3.3 …………..… 110 5.2
4.3.4 5.2.1
5.2.2 5
4.3.5 B+ ..……………
..
4 .4 5.3. 1
4 .4.1 Fi1e Header……………………… 121 5.3.2 ……
.... O
4 .4.2 Page Header…........…·…................ ................122 5 .4
4.4.3 Supremum Records........123 5.4.1
4 .4.4 User Space......… ......123 5.4.2
4 .4.5 Page Directory ……………… ..............124 5.4.3
4 .4.6 File Trailer"…………....... …..………....… ..124 5.4.4
4 .4.7 5.5
4.5 Named Fi1e 5 .5 .1
4.6 .. ..……………
....…………
..………
.... .. .. .. …
.... 5 .5 .2
5.7.1 7. 1.1
5.7.2 7. 1. 2 ..
5.7 .3 7.2
5.8 7.2.1 redO'.............….........................…… ... .294
7.1 8.5.3
XII
8.6
8.7 9.7
9.1 ………....….-383
9.2 10.1
9 .3 10.2
9.3.1 10 .3 MySQL
9.3.2 … …… …....,.........………......…415
9.4 10.3 .1
9.4 .1 10.3.2
9.4 .2 RAID Write 10.4
9.4 .3 ….....................…........……… · ….423
9.5 10.5
Linux ,
1.1
C
C
- l etc/mysql/my.cnf • lusr/locallmysqll
etc/my.cnf • ,...,
Default options are read from the following files in th e g ive n order:
C : \Windows\my.ini C:\Windows\my.cnf C:\my. ini C:\my.cnf C:\program Files\
1.2
o
... ...
4 -."
Native C API. JDBC. ODBC. NET. PHP, PerI, Python. Ruby, Cobol
Zj @
File system
ufs,
,_;;;.-- NFS. SAN, NAS
1.3 5 4b
1.3
dynamìc-rowsl
C...
6
COnline Transaction
1.3.1
4.1
_ _ buffer_pool
..{)I.CA
3
Yahoo
1.3.2
MySQL
1.3.3
C...
8 ‘'
share
key
MySQL NDB
Grade
1.3 .4
(
..'i I.CA
I.3
1.3.5
1.3.6
1.3.7
1.3.8
(
o
10
._.
1.4
mysql>SHOW ENGINES\G;
1. row
Engine : InnoDB
Support: YES
Comment: Supports transactions , row-level locking , and foreign keys
Trar>sactions: YES
XA: YES
Savepoints: YES
***** ******* ******* ******* * 2. row
Engine: MRG_MYISAM
Support: YES
COmment: Col lection of identica l MyISAM tables
Transact ions: NO
XA: NO
Savepoints: NO
*************************** 3. row
Engine: BLACKHOLE
Support: YES
Comment: /dev/null storage engine (anything you write to it disappears)
Transactions: NO
XA: NO
Savepoints : NO
4. row
Engine: CSV
Support : YES
Comment: CSV storage engine
Transactions: NO
XA: NO
Savepoints: NO
5. row
Engine: MEMORY
Support : YES
12
Engine: ARCHIVE
Support: YES
Comment: Archive storage engine
Transactions: NO
XA: NO
Savepoints: NO
8 . row ***...………...*********
Engine: MyISAM
Support: DEFAULT
Comment: Default engine as of MySQL 3.23 with great performance
Transactions: NO
XA: NO
Savepoints: NO
8 rows in set (0.00 sec)
1.5
1.5.1 TCP/IP
mysq1>
mysq1>USE mysq1;
Database changed
mysq1>SELECT host , user , password FROM user;
1. row
host :
u ser: root
password : *75DBD4FA548120B54FE693006C41AA9A16DE8FBE
2. row
host: nineyouO-43
user: root
password : *75DBD4FA548120B54FE693006C41AA9A16DE8FBE
**************************** 3. row
host: 127.0.0.1
user: root
password: *75DBD4FA548120B54FE693006C41AA9A16DE8FBE
4. row
host: 192 . 168 .0.100
user: zlm
password: *DAE0939275CC7CD8E0293812A3 1 735DA9CF0953C
**************************** 5. row
user: david
password:
5 rows in set (0.00 sec)
.ttl.CA
1.5.2
XP , Windows
Microsoft
SQL
1.5.3
mysql>
1.6
16
., I.C...
2.1
Heikki Tuuri
e
.{, I.C...
18
2.2
JnnoDB I.O.x
InnoDB I.l.x
JnnoDB 1.2.x
InnoDB
Native
InnoDB
lnnoDB
2.3
2.3
…...
2.3 .1
C...
20 fIa' --.
1 . Master Thread
Master
2.10 Thread
(Async
back)
10 10
read
io
write io
mysql>SHOW VARIABLES LIKE ' innodb_version'\G ;
*************************** 1. row
Variable name: innodb version
Value: 1. 0.6
1 row in set (0.00 sec )
Thread:
mysql>SHOW ENGINE INNODB STATUS\G;
1. row
Type: InnoDB
Name:
Status:
=====================================
100719 21:55:26 INNODB MONITOR OUTPUT
=====================================
ð. \I , CA
2.3 21"'.
F1LE 1/0
1/0 thread 0 state: waiting for i/o request (insert buffer thread)
1/0 thread 1 state: waiting for i/o request (10g thread)
1/0 thread 2 state: waiting for i/o request (read thread)
1/0 thread 3 state: wa iting for i/o request (read thread)
1/0 thread 4 state: wai ting for i/o request (read thread)
1/0 thread 5 state: waiting for i/o request (read thread)
1/0 thread 6 state: wa iting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
1/0 thread 8 state: waiting for i/o request (wri te thread)
I/O threa d 9 state: waiting for i/o request (write thread)
3. Purge Thread
Thread:
yn
mn lp
sod-
u r qe h r ea dqu -
_p urge_
Thread:
mysql> SELECT VERSION()\G;
1 . row
VERSION(): 5.6.6
1 row in set (0 . 00 sec )
2.3.2
.
_ buffer_p ool_
(insert hash
_ buffer_pool)
(redo log_buffcr)
page)
( insert buffer) info)
index page)
(innodb additional
24 ‘'
_ buffer_p ool_ ••
mysql> SHOW VARIABLES LIKE ' innodb_buffer_pool _ instances ' \G;
1. row
Variable_name: innodb_buffer_pool_ i nstances
Value: 1
1 row in set (0.00 sec)
_ buffer_pool_
… BUFFER POOL 0
Bu ffer pool size 65535
Free buffers 65451
Database pages 84
01d database pages 0
Modified db pages 0
Pending reads 0
Pending writes: LRU 0 , flush list 0 single page 0
Pages made young 0 , not young 0
0.00 youngs/s , 0.00 non-youngs/s
Pages read 84 , created 0 , written 1
9.33 reads/s , 0.00 creates/s , 0.11 writes /s
Buffer pool hit rate 764 1 1000 , young-making rate 0 1 1000 not 0 / 1000
Pages read ahead O.OO/s , evicted without access O.OO/s , Random read ahead O.OO/s
LRU len: 84 , unzip_LRU len : 0
1/0 sum[O] :cu r [O ] , unzip sum (O]:cur(O]
---BUFFER POOL 1
Buffer pool size 65536
Free buffers 65473
Database pages 63
Old database pages 0
Modified db pages 0
Pending reads 0
pending writes: LRU 0 , flush list 0 s ingle page 0
Pages made young 0 , not young 0
0.00 youngs/s , 0.00 non-youngs/s
..{,I. CA
2.3 25--'
_ buffer_pool_
ENGINE INNODB
POOL
BUFFER POOL
EB
RA
FT
DA
2. row
POOL 10 : 1
POOL SIZE: 65536
FREE BUFFERS: 65473
DATABASE PAGES: 63
2. LRU List
(Latest Recent
26 ._'- --.
..{)I.CA
insertion
_old_ blocks
mysql> SHOW VARIABLES LIKE 'innodb_ o ld_blocks_pct'\G;
1 . row
Variable_ name: innodb_ old_ blocks_ pct
Va lue: 37
1 row in set (0.00 sec)
_ old_ blocks
made
ENGINE INNODB
Database
Database pool
pages made
pool hit
pool hit
Per
second averages calculated the last 24
E
& y< ao
+------------+-------+…----------+------------……-+
I I
TABLE NAME SPACEI I
PAGE NUMBER PAGE TYPE
+------------+--- ----+-------------+-------------------+
NULL 1 FILE SPACE HEADER
NULL 1 l IBUF BITMAP
NULL 1 2 INODE
test/tl 1 3 INDEX
+------------+-------+-------------+-------------------+
4 rows in set (0.00 secl
ENGINE
Buffer pool hit rate 999 / 1000 , young-making rate 0 / 1000 not 0 / 1000
Page5 read ahead 0.00/5 , evicted without acce55 0.00/5 , Random read ahead 0.00/5
LRU 1en: 1539 , unzip_LRU 1en: 156
1/0 5um(O) :cur(O) , unzip 5um(0] :cur[Ol
1
C...
30
mysql> SELECT
-> TABLE_NAME , SPACE , PAGE_ NUMBER, COMPRESSED_ SIZE
- > FROM INNODB BUFFER PAGE LRU
-> WHERE COMPRESSED SIZE <> 0;
+-…----------+-------+
I NUL L
---…-------+-------------------+
-
56 I SYSTEM
---
I NULL o I FILE SPACE HEADER I
test/t 3 I INDEX
NULL 320 I INODE
23
log buffer) 0
_log_ buffer_
8MB:
mysq l > SHOW VARIABLES LIKE 'innodb_ log_ buffer_si ze'\G;
1. row
Variable_ name: i n nodb_ l o9_buffer_s ize
Value: 8388608
1 r ow in set (0.00 sec)
o Master
buffer
(buffer control
32
2 .4
Ahead
Oracle
...
( Log Sequence
ENGINE INNODB
mysql> SHOW ENGINE INNOOB STATUS\G;
LOG
o Sharp Checkpoint
o Fuzzy Checkpoint
Sharp
Checkpoint:
o Master Thread Checkpoint
o FLUSH_LRU_LIST Checkpoint
o Async/Sync Flush Checkpoint
Page too much Checkpoint
Thread
FLUSH_ LRU_LIST
LRU _LIST
_lru_ scan_
...
Async/Sync Flush
age<sync_water_
age<async_ water_
mark:
o checkpoint_ age>sync_water_
checkpoint_age<async_
Async/Sync Flush
InnoDB Async Flush
Sync Flush
Page Cleaner
36 . -.
6.() I. c...
too
2.5 Master
Master
(
Master
2'.5 Master
., I.C...
modified_ratio _ max_
dirty_p ages
C...
38
db
oahqoo
--Et
tkdqquo eon
oto
noso
snml
nlhpe E --Wen s econAUq
p--- >
c deoP
‘
qd
....
modified_ratio_p ct ) .
( shutdown
I. CII _
40
flush r
Master
ddqo
ltep
ee--
nnni
sswqd
uuao
D-P ore
--at
p-en
ohVJ
AU{
‘ -
to
o
2.5.2 Thread
Master
coding. Master
Plugin
_ io_ capacity
_io_
_ io_
_io_ capacity 0
_ io_
_pages 1.0.x
42
InnoDB _adaptive_flushing
Master
InnoDB
ENGINE INNODB
na
=====================================
090921 14:24:56 INNODB MONITOR OUTPUT
=====================================
Per second averages ca1cu1ated from the 1ast 6 seconds
BACKGROUND THREAD
: 100 background
ftush
BACKGROUND THREAD
Master
if InnoDB is id1e
srv_master_do_id1e_tasks() ;
e1se
srv_mast er_do_active_tasks();
_ srv master do
active_ Thread
Cleaner
2.6
Insert Buffer)
Double Write)
Hash Index )
( Async 10 )
Neighbor Page )
46
._'- -.
.ttl.CA
2.6.1
1.lnsert Buffer
Insert
Buffer
CREATE TABLE t (
a I NT AUTO INCREMENT ,
b VARCHAR (30) ,
PRlMARY KEY(a)
ATR
PM TNA
RPM ATab LAM
BC
FHHURH
YAHV TR N}
FUPURLMFUNT
,
'
Buffer
Type: InnoDB
Name:
Status:
Ibuf: size 7545 , free 1ist 1en 3790 , seq size 11336 ,
8075308 inserts , 7540969 merqed recs , 2246304 merqes
merged
:
innodb_ buffer_pool)
1** Buffer pool size per the maximum insert bu ffe r size *1
IIdefine IBUF POOL SIZE PER MAX SIZE 2
ibuf->max_size = buf_pool_get_curr_size() 1 UNIV_ PAGE_ SIZE
/ IBUF POOL SIZE PER MAX SIZE;
2. Change Buffer
Insert
Change
_change_
innodb_change_buffer_max_
------------------------
-------------------
Ibuf: size 1 , f ree list len 34397 , seg size 34399 , 1087 5 merges
merged operations:
insert 20462 , delete mark 20158 , del ete 421 5
discarded operations :
insert 0 , delete mark 0 , delete 0
Buffer; delete
Buffer; Buffer; discarded
Insert
MySQL Buffer
Buffer
REPAIR
Insert
key
Insert key
search
Buffer
. 6.{, I.C...
2 .6
Buffer
Buffer
| I I
\
secondary index record
lnsert
IBUF
Insert
Insert Buffer
space , page_
Insert
space , page_ 00
Buffer
Buffer
Buffer
Buffer
C...
52
Insert
o Insert Buffer
o Master
Buffer
Buffer Buffer
Insert Buffer
Buffer
Insert
2.6
srv
BufTer
BufTer
Change
2.6.2
page
54
doublewrite buffer
(2MB)
wntc
doublewrite doublcwrite
( 1MB) ( 1MB)
GLOBAL
_pages_
_dblwr_pages_
Innodb_ buffer_p ool_pages_ _dblwr_p ages_
_dblwr_p ages_
_ innodb_
2.6.3
0(1) ,
Hash Index ,
..ttl.CA
56 ..'- -,.
ENGINE INNODB
mysq1>5HOW ENGINE INNODB 5TATU5\G;
1. row
5tatus:
----------------…------------------
Ibuf: size 2249 , free 1ist 1en 334 6 , seg size 5596 ,
374650 inserts , 51897 merged recs , 14300 merges
Hash tab1e size 4980499 , node heap has 1246 buffer(s)
1640.60 ha.h ..arch../. , 3709.46 non-ha.h ..arch../a
table
WHERE index
searches:non-hash
2.6
2.6 .4
(Asynchronous 10 ,
page_
(8 , 7) , (8 , 8)
space , page_ no
InnoDB
Native
..ttl.CA
58
ffií Mac
read
2.6.5
Neighbor Page
_flush_
2.7
insert
merge insert
insert
_force_
_ force 1""'"
(SRV
_FORCE_NO
.{,I. CA
60
s
4(SRV_ FORCE_NO_IBUF_ MERGE):
Log) , InnoDB
_ force _
mysql>START TRANSACTION ;
Query OK , 0 rows affected (0.00 sec)
START
_ for ce_
force
_ force _
2.8
C...
3.1
I grep
090922 16:25:52 mysq1d started
090922 16:25:53 InnoDB: Started; 10g sequence number 8 2801063211
InnoDB: !!! innodb force recovery is set to 1 !!!
090922 1 6:25:53 [ERROR) Fata1 error: Can't open and 10ck privi1ege tab1es:
Tab1e 'mysq1.host' doesn't exist
090922 16:25 :53 mysq1d ended
MySQL
3.1.1
_ buffer_p ool_
information
VAR1 ABLES.
SQL
3.1.2
SET
I (global I session) system_var_name= expr
I (@@global. I @@session. I expr
mysql>SELECT
1.
C...
mysql>SET @@global.read_buffer_size=1048576;
Query OK , 0 rows affected (0.00 sec)
mysql>SELECT @@session.read_buffer_size\G;
1. ro w
@@session.read buffer size: 524288
1 row in set (0.00 sec)
System
mysql>SET GLOBAL
ERROR 1238 (HYOOO): Variable 'datadir' is a read only variable
3.2
log) ••
3.2.1
log:
090924 11:39:44 InnoDB: ERROR: the age of the 1ast checkpoint is 9433712 ,
InnoDB: which exceeds the 10g group capacity 9433498.
InnoDB: If you are using big BLOB or TEXT rows , you must set the
InnoDB: combined size of 10g fi1es at 1east 10 times bigger than the
InnoDB: 1argest such row.
090924 11:40:00 InnoDB: ERROR: the age of the 1ast checkpoint is 9 433&23 ,
InnoDB: which exceeds the 10g group capacity 9433498.
InnoDB: I f you are using big BLOB or TEXT rows , you must set the
InnoDB: combined size of 10g fi1es at 1east 10 t imes bigger than the
InnoDB: 1argest such row.
090924 11:40:16 InnoDB: ERROR: the age of the 1ast checkpoint is 9433645 ,
InnoDB: which exceeds the 10g group capacity 9433498.
InnoDB: If you are using big BLOB or TEXT rows , you must set the
InnoDB: combined size of 10g fi1es at 1east 10 times bigger than the
InnoDB: 1argest such row.
3.2.2
(slow
query_
v1 --o-
evn
b 'AL
aw
a rz aue qo
e·· --N·
met
nLS le
ss .. oo
qu e E .• e s
W}
a nu
( <U
query_
query_
long_query _
queries_ not_using_
queries_ not_using_indexes:
mysql> SHOW VARIABLES LIKE 'log_queries_ not_using_indexes'\G:
1. row
Variable_name: log_queri es_not_ using_indexes
Value: ON
1 row i n set (0.00 sec)
R 9 0
Coun t : 653 Time;O.OOs (Os)
SC)@[192 . 168.43.7 )
se1ect custom_name_one from '10w_game_schema'. ' ro1e_detai1s' where r01e_id='S'
rse and summarize the MySQL slow query 10g. Options are
--verbose verbose
--debug debug
--he1p write this text to standard output
-v verbose
-d debug
- s ORDER what to sort by (a1 , at , ar , c , 1 , r , t) , ' at ' is defau1t
a1: average 10ck time
ar: a v erage rows sent
at: average que r y time
c: count
1 : 10ck time
r: rows sent
t: query time
-r reverse the sort order (largest 1ast instead of ßrst)
-t NUM just show the top n queries
-a don't abstract a11 numbers to N and strings to ' S '
-n NUM abstract numbers with at 1east n digits within name s
-g PATTERN grep : on1 y consider stmts that inc1ude this string
-h HOSTNAME hostname of db server for *-slow.1og fi1ename (can be wi1dcard) ,
defau1t is '*', i . e. match a11
-i NAME name of server instance (if using mysq1 . server startup script)
-1 don't subtract 10ck time from tota1 time
MySQL
70 ‘ v
Tab1e: slow_log
Create Tab1e: CREATE TABLE 'slow_log' (
'start_time' timestamp NOT NULL DEFAULT CURRENT_ TIMESTAMP ON UPDATE CURRENT
TIMESTAMP ,
'user_host' mediumtext NOT NULL ,
'query_time' time NOT NULL ,
' lock_time' time NOT NULL ,
'rows_sent ' int(ll) NOT NULL ,
'rows_examined' int(l l ) NOT NULL ,
'db' varchar(512) NOT NULL ,
' last_insert_id' int(ll ) NOT NULL ,
'insert_id' int(ll) NOT NULL ,
'server_id' int(ll) NOT NULL ,
'sq1 text' mediumtext NOT NULL
ENGINE=CSV DEFAULT CHARSET=utf8 COMMENT='Slow log'
1 row in set (0.00 sec)
1+
--a-m-e-l+-------+
+--------…----+--
v-
a- a e-n-
-l-
E- hu-
,
e-
a-u-HV'
+
I 1og_output I FILE I
+------------……+- --------+
1 row in set (0.00 sec)
+----------- +
o I
+------ -----+
1 row in set ( 1 0.01 sec)
z ow s }
query_
slow
slow
log
slow log
slow log
log
3.2.3
.{) I. CA
3.2 73- .
3.2 .4
iDEd
poqdG
oqdnt
s-0·l
-lq
Bot
n
--e
BXncde
14u
-
pu d
Evnb
‘
-l
C...
End_log_poS: 120
Info: Server ver: 5.6.6-m9-1og , Binlog ver: 4
2. row
Lee-
qdtvoeseds
apy-p
onz1&
ntr- qr
vdsoe9
mlQIl d
ly
--········
mop--10 AU
<nuhu oo
hu
--e -U
4UQJ
<
vsd
En
q
Info: BEGIN
3. row ***************************
Lee
apy
onz
ntE
qdtv m1Qld nununununu
VJs9e
esed qar
F
YU
<
D
UM VS
-e
pun
vnbAu
-eq
PUM
Info: COMMIT
4 rows in set (0.00 sec)
BINLOG
.{)I.C...
(datadir ),
mysq1> show variab1es 1 i ke 'datadir';
+---------------+----------------------…-…--+
I Variab1e name I Value
+------------ ---+------------ ----------------+
I datadir I /usr/1oca1/mysq1/data/ I
+…--------------+----------------------------+
1 row in set (0.00 sec)
replication
o binlog_format
_ binlog_
073741 G _ binlog_
uncommitted)
cache_
cache_
cache_ size
+-------------------+---…-+
1 row in set (0.00 sec)
cache_
3 .2
_ binlog=
_ binlog=
_ support_ _support_
binlog_
Microsoft SQL
MySQL
C...
‘'
( 1)
temporary
binlog_
+-----………-------------------+
I @@session.binlog_ format I
+-------------…---…----------+
I ROW
+------------------ - ------------ +
1 row in set (0.00 sec)
+-----…---------------…-----+
I ROW
+------------------ ------------+
1 row in set (0.00 sec)
iDEt
poq
s-oe
n--
lIn
iq
BOW
B1
-ln --o -{
E <
U
<
A U
poqiDrt
s-oe
oqns ,
Bow
iqlIn
n--l
Bllo
nr ·- --{
O <
u AV e
_ binlog= 1
3 .2
'090 927 15:43:11 server id 1 end_ log_pos 376 Query thread_id; 188 exec
time;1 error code=O
SET TIMESTAMP=1254037391/*!*/;
update t2 set username;upper(username) where id=1
, at 376
'090927 15:43:11 server id 1 end_ 10g_p os 403 Xid; 1009
COMMIT/*!*/;
DE LIMITER ;
, End of 10g fi1e
ROLLBACK /* added by mysqlbin10g */;
/*!50003 SET COMPLETION TYPE=@OLD COMPLETION TYPE*/;
11 at 1135
, at 1198
11090927 15:53:52 server i d 1 end_ 1og_p os 1198 Tab1e_map: 'member'.'t2' mapped
to number 58
'090927 15:53:52 server id 1 end_ 1og_pos 1378 update_ rows: table id 58 flags:
STMT END F
BINLOG '
tt l. e
82
••
/gJAAAAA
EBq/ShgBAAAAtAAAAGIFAAAQADoAAAAAAAEACv////8A/AEAAAALYWx1eDk50Dh5b3UEOX1vdSA3
Y2JiMzI1 Mm JhNmI3ZT1jNDlyZmFjNTMzNGQyMjAlNAFNLacPAAAAAABjEnpxPBlAAAD8AQAAAAtB
AGMSenE8EgAA
'/*!*/;
1 at 1378
1090927 15:53:52 server id 1 end_10g_p os 1405 Xid = 1110
COMMIT/*!*/;
DELIMITER ;
jj End of 10g lile
ROLLBACK /* added by mysq1bin10g */;
/*!50003 SET COMPLETION TYPE=@OLD COMPLETION TYPE*/;
BINLOG '
EBq/ShMBAAAAPwAAAK4EAAAAADoAAAAAAAAABm11bWJ1cgACdDIACgMPDw/+CgsPAQwKJAAoAEAA
/gJAAAAA
EBq/ ShgBAAAAtAAAAG1 FAAAQADoAAAAAAAEACv / / / / 8A/ AEA.A AALYWx1eDk50Dh5b3UEOX1 vdSA3
Y2JiMzI1 MmJhNmI3ZT1jNDlyZmFjNTMzNGQyMjAlNAFNLac PAAAAAABjEnpxPBlAAAD8AQAAAAtB
TEVYOTk40F1PVQQ5eW91IDdjYmlzMjUyYmE2Yjd10WMOMjJmYWM1MzMOZDlyMDUOAUOtpw8AAAAA
AGMSenE8EgAA
'/*!*/;
11111 UPDATE member.t2
#11 11 WHERE
1#' @1=1 /* INT meta=O nu11ab1e=0 is nu11=0 */
111. @2 = 'david' / * VARSTRING(36) meta= 36 nu11ab1e=0 is nu11=0 */
1## @3='fami1y' /* VARSTRING(40) meta=40 nullable=O is_nu11=0 */
11 l1li @4='7cbb3252ba6b7e9c422fac5334d22054' /* VARSTRING(64) meta=64 nu11ab1e=0
is nu11=0 */
HII @5= ' M' /* STRING(2) meta=65026 nu11able= 0 is nu11=O */
#11 11 @6='2009:09:13' /* DATE meta= O nu11ab1e=O is nu11=0 */
IIU @7 = 'OO:00:00' /* TIME meta=O nu11ab1e=0 is nu11=O */
11## @8= " /* VARSTRING(64) meta=64 nu11ab1e=O i s nu11= 0 */
HII @9=O /* TINYINT meta=O nu11ab1e=0 is nu11=0 */
.u @10=2009-08-11 16:32:35 /* DATETlME meta=O nu11able=O is nu11=0 */
'U SET
#., @1=1 /* INT meta=O nu11able=O is null=O */
{,I."
'f'.
'" @2= 'OAVIO' /* VARSTRING(36) meta=36 nu11ab1e=0 is nu11=0
-
@3=fami1y /* VARSTRING(40) meta= 40 nu1 1ab1e=0 is_nu11=0 */
..
'"
is nu1 1=0 ‘
@4='7cbb3252ba6b7e9c422fac5334d22054'
i
/* VARSTRING(64) meta=64 nu11ab1e=0
'"
,
@10=2009-08-11 16:32:35 /* OATETIME meta= O nu11ab1e=0 is nu11 a O */
at 1378
'090927 15:53:52 server id 1 end_10g_pos 1405 Xid = 1110
COMMIT/*!*/;
OELIMI TER ;
of 10g file
ROLLBACK /* added by mysq1bin1og */;
/*!50003 SET COMPLETION TYPE=@OLD COMPLETION TYPE* /;
t2
set usemame=upper( usemame )where id=
3.3
3 .4
mysql> show variables li ke ' pid_ lile'\G;
1. row
variable_name : pid_file
Value : lusr/local/my sql/data/xen- server.pid
1 row in set (0 .00 sec)
3.5
3.6
3.6
., I. CA
3.6.1
( tablespace _ data_file
i nnodb_ data_ fi 1e _p at h= daeafi1 e_specl [ ; daeafile_spec2 ] . • .
[mysq1d ]
i nnodb_data_fi1e_pat h = /db/ i bdata1:2000M; /dr2/db/ i bda t a2:2000M:autoextend
_ data_fìle
_file_p er_
_ file
mysq1 >SHOW VARI ABLES LIKE • i nnOdb_fi1e _ pe r_tab1 e' \G;
**** *** ******************** 1 . row
Variab1e_ name: innodb_fi1e _per_ tab1e
Va 1ue: ON
1 r ow i n s e t (0. 00 sec)
_ file _p er_
, • ‘ ‘ •
.. ..._'
•
.'…
:
i
:3
;;
InnoDB
share
tablcspace
-ullz ;
i l..·.__
\ .ibd files
3.6.2
log
log
.{) I. c...
3.6 87 --'
ib_logfil eO
ib_logfile2 ib_Iogfile I
(J innodb_ log_fìles_in_group
(J innodb_ mirrored_log_groups
(J innodb_log_group_home_dir
_ log_ files_ in
_ mirrored
_log_group_ home_
4. row
Variab1e_ name: innodb_10g_file_si ze
Va1ue: 5242880
5. row ..
Variab1e_name: innodb_109_files_in_group
Va1ue: 2
.
******.******************** 6. row
Variab1e_ name: innodb_10g_group_home_dir
Va1ue: ./
7. row
Variab1e_ name: innodb_ mirrored_10g_9 rou Ps
Va1ue: 1
7 rows i n set (0.00 sec)
090924 11:39:44 1nnoOB: ERROR : the age of the last checkpoint is 9433712 ,
lnnoOB: which exceeds the 10g group capacity 9433498.
1nnoOB: 1f you are using big BLOB or TEXT rows , you must set the
1nnoOB: combined size of 10g tiles at 1 east 1 0 t i mes b i gger than the
1nnoOB: 1argest such row.
090924 11:40:00 1nnoOB: ERROR: the age of the 1as t chec kpo int is 9433823 ,
1nnoDB : which exceeds the 10g group capacity 9433498 .
lnnoDB: If you are using big BLOB or TEXT rows , you must set the
ln noDB: combined size of log files at l east 10 times bigger than the
1nnoDB : 1argest such row.
090924 11:40:16 1nnoOB: ERROR: the age of the 1 as t checkpoint i5 9433645 ,
1 nnoDB: which exceeds the log group capacity 9433498.
lnnoDB : 1f you are u5ing big BLOB or TEXT rows , you must set the
lnnoOB : combined size of 10g fi1es at 1east 10 times bigger than the
1nnoOB: 1argest such row.
entry
.{) I. CA
36
log
'a d o OohM zu mw
_ftush _log_at_trx._
3.7
in
MySQL
C...
4.1
(Primary
NOT
4.2
'
, , , '
, ,,
,, R-V t '"nt
,, - A
Page
Row "
4.2.1
_file _per_
Double write
_ fil e_p er_
file
C...
mytest set
mysq1> ROLLBACK;
Query OK , 0 rows affected (0.00 sec)
r
_ innodb _page _
node segment) ,
node
lnnoDB
lnnoDB
_file_per_
_innodb_page_
[ root@nin eyouO - 43 py)l ./py_i n nodb_pag e_in fo.py -v l usr /1oca1/my sq1 /da t a/ t es t l
t l . i bd
.{)I.CA
4.2 97.
mysql> DELIMITER/I
mysq1> OELIMITER ;
_ innodb_page_
page offset OOOOOOOe , page type <B- tree Node> , page 1eve1 <0000>
page offset OOOOOOOf , page type <B- tree Node> , page 1eve1 <0000>
page offset 00000010 , page type <B-tree Node> , page 1eve1 <0000>
page o f fset 00000011 , page type <B- tree Node> , page 1eve1 <0000>
page offset 00000012 , page type <B-tree Node> , page 1evel <0000>
page offset 00000013 , page type <B-tree Node> , page leve1 <0000>
page offset 00000014 , page type <B-tree Node> , page 1evel <0000>
page offset 00000015 , page type <B-tree Node> , page level <0000>
page offset 00000016 , page type <B-tree Node> , page 1evel <0000>
page offset 00000017 , page type <B-tree Node> , page leve1 <0000>
page offset 00000018 , page type <B-tree Node> , page 1eve1 <0000>
page offset 00000019 , page type <B-tree Node> , page 1eve1 <0000>
page offset 0000001a , page type <B-tree Node> , page 1evel <0000>
page offset 0000001b , page type <B-tree Node> , page level <0000>
page offset 0000001c , page type <B-t ree Node> , page level <0000>
page offset 0000001d , page type <B-tree Node> , page level <0000>
page offset 0000001e , page type <B-tree Node> , page leve1 <0000>
page offset 0000001f , page type <B-tree Node> , page leve1 <0000>
page offset 00000020 , page type <B-tree Node> , page leve1 <0000>
page offset 00000021 , page type <B-tree Node> , page level <0000>
page o ffse t 00000022 , page type <B-tree Node> , page level <0000>
page offset 00000023 , page type <B-tree Node> , page level <0000>
Total number of page: 36:
Insert Buffer Bitmap: 1
File Space Header: 1
B-tree Node: 33
File Segment inode: 1
_ innodb_page_
InnoDB _p age_
_p age_
Node )
Log Page)
Page)
system Page )
Buffer Bitmap )
Insert Buffer Free List)
BLOB Page)
BLOB page)
MySQL
Big
/02
4.3 ••
SQL
Name: mytest
Engine: InnoDB
Version: 10
Row_forma t : Compact
Rows: 6
Avg_ row_length : 2730
Da ta_length: 16384
Max_da ta_ length: 0
Index_ length: 0
Data free: 0
Auto increment: NULL
Create time: 2009-03-17 13:33 : 50
Update_tim e: NULL
Chec k time: NULL
Collation: latinl swedish ci
Checksum: NULL
Create_op tions:
Comment:
********** ********** ******* 2 . row
Nq een
a--l
mno tn
mwvA SDRUS
nE
Ee
v s -A
Row f OR-
zomat RMH d t
-w
sqq
wnn
·-tt
ot ee ‘ n
AV g ra
-D -
a - -n 6
-
..{t I. CA
Max dnte
-zad -
axee ....nu
'L hh
nn
- .,.
Data free: 0
<
U
_innodb_p age_
4.3.1
J. *. ...... .. ..
header)
-.
.ttl , CA
._'-
dclctcd_f1 ag
min_rcc_ f1ag
n owned 4
hcap_no 13
001
record_ typc 3
Suprcmum.
next rccord 16
Total 40
t1: a
t2: bb
t3: bb
t4: ccc
2. row
t1: d
t2: ee
t3 : ee
t4: fff
3. row
t1: d
t2: NULL
t3: NULL
t4: fff
3 rows ìn set (0.00 sec)
mytest.ibd >
03 02 */
00
00 00 10 00 2c /*Record
00 00 00 2b 68 OO/*RowID
00 00 00 00 06 05/*TransactìonID*/
80 00 0000 32 01 10/ *Ro11 Poìnter*/
‘-
62 */
62 62 20 20 20 20 20 20 20 */
63 63 */
Pointer
recorder ,
03
00 00 20 ff 98/*Record Header*/
00 00 00 2b 68
00 00 00 00 06 07/*TransactionIO*/
80 00 00 00 32 01 10/ *Ro11 Pointer*/
*I
66 66
4 .3 .2
t:...
4.3
header
deleted_ flag
min_rcc_ flag
n owned 4
heap_no 13
n fìelds 10
Ibyte_offs_fiag
ncxt record 16
Total 48
-
r
Create time: 2009-03-18 15:49:42
Update_time: NULL
Check time: NULL
Collation: latin1 swedish ci
Checksum: NULL
Create_ options : row_ format =REDUNDANT
Comment:
1 row in set (0.00 sec)
t1: a
t2: bb
t3: bb
t4: ccc
2. row
tl: d
t2: ee
t3: ee
t4: fff
3. row
tl: d
t2: NULL
t3: NULL
t4: fff
3 rows in set (0.00 sec)
23 20 16 1 4 13 Oc
00 00 10 Of 00 ba/ * Record
00 00 00 2b 68 Ob/ * Ro wIO* /
00 00 00 00 06 53/ *TransactionI D*/
80 00 00 00 32 01 10/*Roll Poi nt*/
'a' */
62 */
62 62 20 20 20 20 20 20 20
63 63 */
,...__
0000000111
21 ge 94 14 13 Oc
00 00 20 Of 00 74/*Record
00 00 00 2b 68 Od/*RowID*/
00 00 00 00 06 53/*Transacti onIO*/
80 00 00 00 32 01 10/ * Roll Point* /
•/
00 00 00 00 00 00 00 00 00
66 66
13 1494 ge
I 10 $
4 .3.3
SQL
_innodb_p age
BLOB
0
nununUAUnunU c
CCCCCCCCCC oaoooo
ba050 39 fbaoa06c5
fnunvoonvoob-
g
ff7010d311 --g
LAU<Un I g. . . . . . . . . . . . . . . 1
1 0000od AU
1.... j ...E....... 1
2 21 <
UAU<U
3
&03ddo U
4 AUAUAUA
2
56789abede <unue··nu
1• • • • • • • • • • • • • 2 • • I
AU 9 eRd
i nfimum. . . . . . 1
1• • •
n 2611
oool U<
UAU I s up remum ....... . 1
b1 U
1 • • • • + . . . •QK . • • • • 1
nuhUAVAU<unu l--l 6 rozororoz r
orororororo
•• 1-. . aaaaa aaaaaaaa l
C 1111 6 11111
-11l1
l aaaaaaaaaaaaaaaa l
CCCC•• - 1 666
•• ••
l aaaaaaaaaaaaaaa a l
-l1l ••
l aaaaaaaaaaaaaaa a l
.• 1 ll o
l aaaaaaaaaaaaaaaa l
,A 1 1 6 ro
l aaaaaaaaaaaaaaaa l
OOOOcOfO 61 61 61 6 1 61 61 6 1 6 1 61 6 1 61 61 61 61 61 61 l aaaaa aaa aaa aaaaa l
0000c100 61 61 61 61 61 6 1 61 61 61 61 6 1 61 61 61 61 61 I aaaaaaaaaaaaa a aa I
0000c110 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 61 1 aaaaaaaaa a aaaaaa I
(65532)
BLOB
prcfix 768bytes
BLOB Pagc
...
_ innodb_p age_
_ innodb_page_
., I. CA
SQL
Uncompressed BLOB
_innodb_page
4.3.4 ••
InnoDB
| I • I ...... I
OffPage
4 .3.5
CHAR LENGTH(a): 2
LENGTH(a): 4
3. row
a: a
CHAR LENGTH(a): 1
LENGTH(a): 1
3 rows in set (0.00 sec)
HEX(a): CED2C3C7
*************************** 3. row ***************************
a: a
.ttl , CA
4.3
HEX (a): 61
3 rows in set (0.00 sec)
ab I
02
00
00 00 10 00 1c /* Recoder Header */
00 00 00 b6 2b 2b /* RowID */
00 00 00 51 52 da */
80 00 00 00 2d 01 10 /* Ro11 Point */
61 62 */
04
00 /*
00 00 18 ff d5 / * Recoder Header */
00 00 00 b6 2b 2c /* RowID */
00 00 00 51 52 db /* TransactionID */
80 00 00 00 2d 01 10 /* Roll Point */
c3 d2 c3 c7 */
02
00 /*
00 00 20 ff b7 /* Recoder
00 00 00 b6 2b 2d /* RowID * /
00 00 00 51 53 17 /*
80 00 00 00 2d 01 10 /* Roll Point * /
61 20 */
-.
..ttl.CA
._'-
4 .4
Header
o Page Header
o Records
Records
Space
Dircctory
o File Trailer
..{,I. CA
4.4 121 - .
PageHeader
Infimun +
User Records
Page Size
PageDirectory
,
File Trailer
4 .4 .1 File Header
File
File
Page
LEFT ( OxOI )
RIGHT (Ox 02)
PAGE D1 RECTION 2
a PAGE SAME REC (Ox03)
SAME PAGE (Ox04)
NO D1RECTION (OX05)
PAGE N D1RECTION 2
PAGE N RECS 2
PAGE MAX TRX ID 8
PAGE LEVEL 2
PAGE INDEX ID 8
ð.{t I , CA
••
header
PAGE BTR SEG LEAF 10
4 .4 .3 Record
B+ Tree
, , -
Record
User InnoDB
Free
C...
.,'- -,.
4 .4 .5 Page
Page Directory
InnoDB
Page
File
File
C...
M
MySQL _ checksum_
strict
4 .4 .7
mysql> DELIMITER $$
mysql> CREATE PROCEDURE load_t (count INT UNSIGNED)
-> BEGIN
-> SET @c ; 0;
-> WHILE @c < count 00
-> INSERT INTO t
-> SELECT NULL , RE PEAT(CHAR(97+RANO() *26 ) , 10);
-> SET @c =@c+ l ;
-> ENO WH ILE;
-> ENO;
- > $$
Query OK , 0 rows affected (0.00 sec )
8 yyyyyyyyyy
9 yyyyyyyyyy
10 I vvvvvvvvvv
_innodb_p age_
[roo t@nineyouO - 43 mytes tlf py_ innodb_ page _inf o .py -v t.ibd
page offset 00000000 , p age type <File Space Header>
page offset 0000000 1 , page type <Inser t Buffer Bitmap>
page offse t 00000002 , page type <File Segment inode >
page offset 00000003 , page type <B-tree Node> , page level <0000>
page offse t 00000000 , page type <Freshly Allocated Page>
page offset 00000000 , page type <Freshly Allocated Page>
Total n umber of page: 6:
Freshly Alloca ted page : 2
Insert Buffer Bitmap: 1
File Space Header: 1
B-tree Node: 1
File Segment inode: 1
C...
4.4 127--'
f00000000od00009
f5d0105ab4180249oe21004oa
fbcob0608666060606010200
ffooaod004d802090eoood00
fooooooooac812095e01218
f06002500008d2090e010
f000000000oad2190e6
0916od666606060,bolo200087670
33a40cddd408020900od00009d9
EOOOC2bod00002d9
oaooooe504280221000oa1E1909aroob
ooc3006d04080200odoooof-d90906o
oc0000951408320921800oa29190
OOOOcOOO IR.$.............I
0000c010 1....j...E.......1
0000c020 1• • • • • • • • • • •f . .. . 1
0000c030 1.... .c.d. ... . ...1
0000c040
0000c050 1 • . • • . • • • • • • . • 2. • 1
0000c060 1 . . . infimum. • • . • . 1
0000c070 Isupremum..... .". 1
0000c080 1......Qm.....-.. 1
0000c090 Idddddddddd...... 1
OOOOcOaO 1".......Qm..... - 1
OOOOcObO 1 ..hhhhhhhhhh.... 1
OOOOcOcO 1 .".......Qm....1
OOOOcOdO 1 .-. .bbbbbbbbbb.. 1
OOOOcOeO 1..(.".......Qm..1
OOOOcOfO 1 • • • -. • iiiiiiiiii 1
0000c100 1....0.".......Qm l
OOOOcllO 1 • • • • • - • • nnnnnnnn 1
0000c120 1nn. . . . 8 . " . . . . . . . 1
0000c130 .• IQm.... . -. . qqqqqq 1
0000c140 ••
1qqqq. . . . @. .. . . . . . 1
0000c150 .• 1 . . Qm. . • . . - • .00001
0000c160 1000000.. ..H." . ..I
0000c170
1. 1 . . . . Qm: . • . • -. • yy 1
000oa5bl
0000c180 lyyyyyyyy....P.... 1
0000c190 1......Qm.....-.. 1
0000c 1aO l yyyyyyyyyy....X. 1
0000c1bO
1 .. 1".......Qm..... -1
60bc
0000c1cO 1. .vvvvvvvvvv.... 1
OOOOcldO 1 '.".......Qm....1
·od
0000c1eO 1 • -. • kkkkkkkkkk. • 1
OOOOclfO 1..h..........Qm.. 1
OOOOffcO 00 00 00 00 00 70 Od ld Oc 95 Oc Od Ob 85 Oa fd 1 • • • • • p. . . . . . . . . . 1
OOOOffdO Oa 75 09 ed 09 65 08 dd 08 55 07 cd 07 45 06 bd 1 .u.. .e.. .U.. .E.. 1
OOOOffeO 06 35 05 ad 05 25 04 9d 04 15 03 8d 03 05 02 7d 1 • 5. . • • • • • • • •} 1
OOOOfffO 01 f 5 01 6d 00 e5 00 63 95 ae 5d 39 6a eO ac 93 1 ...m...c..19 j ... 1
. --. C...
lb 24
o ffffffff
0
o 0
0000000 Oa 6a eO ac
0000000
95 ae 5d 39 6a eO ac 93
ae 5d 39.
eO ac
Page
OOOOffcO 00 00 00 00 00 70 Od 1d od Ob85Oa f d |
OOOOffdO Oa 75 09 ed 09 65 08 dd 08 55 07 cd 07 45 06 bd 1 .u...e. .1
OOOOffeO 06 35 05 ad 05 25 04 9d 04 15 03 8d 03 05 02 7d • • • • • • • • } 1
OOOOfffO 0 1 f5 01 6d 00 e5 00 63 95 ae 5d 39 6a eO ac 93 1.. .m...c..]9j... 1
PAGE HEAP
PAGE N
PAGE
PAGE
PAGE LAST
PAGE
PAGE
PAGE
N HEAP
PAGE
PAGE
PAGE INDEX
fI
00 02 00 1c /* recorder header */
69 6e 66 69 6d 75 6d 00
/* .. /
11
00 Ob 00 00 /* recorder header */
73 75 70 72 65 6d 75 6d */
Oxc07f
00 00 00 01 */
00 00 00 51 6d eb /* Transaction ID */
80 00 00 00 2d 01 10 /* Ro11 Pointer */
64 64 64 64 64 64 64 64 64 64 */
.{,I. CA
4.4 J3J - .
+---+------------+------------------------…-----+
1 1 1 dddddddddd 1 64646464646464646464 1
+---+------------+ --------------------------------+
1 row in set (0.00 sec)
Page
OOOOffcO 00 00 00 00 00 70 Od 1d Oc 95 Oc Od Ob 85 Oa fd ,... . .p.. . ....... 1
OOOOffdO Oa 75 09 ed 09 65 08 dd 08 55 07 cd 07 45 06 bd 1 .U.. .e. ..U. .. E .. 1
OOOOffeO 06 35 05 ad 05 25 04 9d 04 15 03 8d 03 05 02 7d • • • • • • • • 11
OOOOfffO 01 f5 01 6d 00 e5 00 63 95 ae 5d 39 6a eO ac 93 1 . ..m...c.. 19j ... 1
Page
00
OOOOcOeO 04 00 28 00 22 00 00 00 04 00 00 00 51 6d ee 80 1..(..........Qm..1
OOOOcOfO 00 00 00 2d 01 10 69 69 69 69 69 69 69 69 69 69 1.. .-. . iiiiiiiiii l
0000cl00 Oa 00 00 00 30 00 22 00 00 00 05 00 00 00 51 6d 1....0..... .. ...Qm l
0000c110 ef 80 00 00 00 2d 01 10 6e 6e 6e 6e 6e 6e 6e 6e 1 . . . . . -. • nnnnnnnn 1
0000c120 6e 6e Oa 00 00 00 38 00 22 00 00 00 06 00 00 00 Inn .... 8..........1
0000c130 51 6d fO 80 00 00 00 2d 01 1 0 71 71 71 71 71 71 IQm .. ...-..qqqqqql
0000c140 7 1 71 71 71 Oa 00 00 00 40 00 22 00 00 00 07 00 Iqqqq....@." ..... 1
Record
‘'
..,.#t
COff
File
Dynamic
InnoDB
"Gazel le" ,
" Hornet" ,
" Impala " ,
" Jaguar " ,
" Kangaroo" ,
"Leopard" ,
IIMoose" ,
"Nautilus" ,
"Ocelot" ,
"Porpoise" ,
"Quail" ,
"Rabbi t" ,
"Shark" ,
"Tiger " ,
" Urchin" ,
" Viper" ,
"Whale" ,
"Xenops" ,
" Yak" ,
"Zebra"
};
@@version: 5.1.37
1 row in set (0.00 sec)
o ( e
.{,I. CA
s
4.6
4.6.1
Primary
Foreign
o Primary Key
Key
o Foreign Key
4.6
4.6.2
oreign
4.6.3
4.6 .4
2009-02-30' 0
4.6.6
I 40 A
MySQL
CREATE
(DEFINER = { user I CURRENT USER }J
TRIGGER trigger_name BEFOREIAFTER INSERTIUPDATEIDELET E
ON tbl_name FOR EACH ROW trigger_stmt
EACH
mysql> DELIMITER $$
Query OK , 0 rows affected (0.00 sec)
mysql> DELIMITER $$
Query OK , 0 rows affected (0.00 sec)
_ err
_ usercash_
_ err
mysql> DELETE FROM usercash;
Query OK , 1 row affected (0.02 sec)
userid: 1
cash: 100
1 row 1n set (0.00 sec)
_err
4.6.7
DELETE
o SETNULL
o RESTRICT
UPDATE ,
SQL Server
CREATE
4.7.1
CREATE
(OR REPLACEJ
[ALGORITHM = {UNDEFINED I MERGE I TEMPTABLEJ ]
[DEFINER = { user I CURRENT USER JJ
[SQL SECURITY ( DEFINER I INVOKER J)
VIEW view name [( co1umn 1ist))
AS se1ect stateme n t
[WITH [CASCADED I LOCAL) CHECK OPTIONj
( updatable CHECK
CHECK
mysql> ALTER VIEW v t
-> AS
-> t WHERE id<10
CHECK OPTION;
Query OK , 0 rows affected (0 . 00 sec)
Tables_in_mytest: t
2. row
Tables_i n_mytest : v_t
2 rows in set (0 . 00 sec)
SQL
mysql> SELECT " FROM information schema.TABLES
-> WHERE table_ type- ' BASE T ABLE'
-> AND table
1. row
data)
mysq l> SELECT * FROM
-> info r mation s che ma . VIEWS
- > WH ERE tabl e sC h ema =database()\G ;
1 . row
4 .7.2
SQL
o BUILD IMMEDIATE
DEFERRED
BUILD
BUILD
C...
--.
OONDEMAND
OONCOMMIT
ON
OCOMPLETE
.0 FORCE
CJAU
3. row
oddea
ru dm
etpm
r-ro
··e··
-n-lu
pr HU-
et EO<
U
4. row
order id: 4
product name: CPU
p rice: 105.30
amount: 4
4 rows in set (0.00 sec)
mysql>
mysql>
mysql> SELECT * FROM Orders MV\G;
1 . row
tp-m
p r o d U eap-O .. C6m··t
e---a
nacneE
met-sU·23
-luce 3uqn
nu-
svc
rr qJ
-
a-e
-
SS
en
r H }
DELIMITER $$
RFOE
ETRGSSS
CAFB
RAPH
pM GGTWpa
RS ROt
EzmEe n
qo-t-
ds
Ers-a
EEm
T··PHDHAUAUAUFeEp
oemuq Se q--e zOJ
.lnJ
E -
duSV
RO NCUC
RA
Y-
-PHPUP-
lll --oi zz
unu <
---
= ·'
,
5ET @o l d orders cnt = 0;
ENO;
$$
OELIMITER ;
svc
-
a ,.. 3d
.
2 . row
pr e--uce
oapon--Ea
uroLd oz vd
MOB-
e6m··t
asve
m9uqn
-GP-mZE eO
mRd
-et-s
··a"2··
. -.
C...
3. row
oadpmrrs
etenern
n--
uro---d e9m·
·· eanunu
asvce
m2uqnt nunu
P
-r
·
-LUce
e 9
t- ··
-
p a 2
-OH ·
S t ··
-
-A s { se c}
4.8
4.8.1
MySQL
Ç)
48
2 . row
Name : partition
Status: ACTIVE
Type: STORAGE ENGINE
Library: NULL
License: GPL
5.5
5.5
CREATE TABLE t l (
coll INT NULL ,
co12 DATE NULL ,
co13 INT NULL ,
co14 INT NULL
)engine=innodb
PARTITION BY HASH(co13)
PARTITIONS 4:
CREATE TABLE t l
co1l INT NULL ,
co12 DATE NULL ,
co13 INT NULL ,
co14 INT NULL ,
key (co14)
)engine=innodb
4.8
PARTITION BY HASH(co13)
PARTIT IONS 4;
4.8.2
CREATE TABLE t (
i d INT
)ENGINE=INNDB
PARTITION BY RANGE (id) (
PARTITION pO VALUES LESS THAN (10) ,
PARTITION p1 VALUES LESS THAN (20)) ;
t# P#p l .ibd:
TABLE ROWS: 2
AVG ROW LENGTH: 8192
DATA LENGTH: 16384
MAX DATA LENGTH: NULL
INDEX LENGTH: 0
DATA FREE: 0
CREATE TIME: NULL
UPDATE TIME: NULL
CHECK TIME: NULL
CHECKSUM: NULL
PARTITION
NODEGROUP: default
TABLESPACE NAME: NULL
2 rows in set (0.00 sec)
TABLE
FROM sales WHERE date>= , 2008-01-01' and date < , 2009-01-01 ' ,
-> WHERE date>= '2008-0 1-01' AND date<= '2008-12-31 ' \G;
1 . row **************************.
id: 1
sel ec t _ typ e: SIMPLE •
table: sales
partitions: p2008
type: ALL
possible_keys: NULL
k ey: NULL
key_ len: NULL
ref: NULL
rows : 5
Extra: Using where
1 row in set (0.00 sec)
Pruning
id: 1
select_type: SIMPLE
table : sales
part i ti o ns: p2008 , p2009
t ype : ALL
possible_ keys : NULL
key: NULL
key_le n: NULL
ref: NULL
rows: 5
Extra: Using where
1 row i n set ( 0 .00 sec)
id: 1
select_type: SIMPLE
table: sales
partitions: p201001 , p201002 , p201003
type: ALL
possibl e_keys: NULL
key: NULL
key l en: NULL
ref: NULL
rows: 4
Extra: Us i ng whe re
1 row in set (0.00 sec)
p201002 ,
TO_
SECONDSO ,
id: 1
select_ typ e : SIMPLE
table: sales
partitions : p201001
type: ALL
possible_keys: NULL
key : NULL
key_len: NULL
ref: NULL
rows: 4
Ex tra : Using where
1 row in set (0.00 sec)
2.
LESS
( ec}
U AU cu
<
2) , ( 2 , 4)
mysql> t;
Empty set (0.00 sec)
BY HASH
164
-2
2. row
a btb
- e n- --
mem
an as KH
hu'A
-n -
pa E --a-L oe a e· P
l Eo ws ·
.. * ,..... 3. row
a e n ano
mems
: a s hu
-n -nr
pa r -lao awe ..
m
e r ··
4 . row
t able name: t h ash
parti t i on_name: p3
e
5--
3
tab l e rows: 0
6
4 rows in set (0.00 sec )
linear
201 0-04-01
YEAR( , 2010-04-01
4. row * * '*..
tab1e name: t l i near hash
partition name: p3
tab1e rows: 0
4 rows i n set (0.01 sec)
LINEAR
interger )
YEARO , TO_DAYSO ,
RANGE
.{,I. CA
4.8 167- .
4.8.3
partitioning)o
•••
ts'Plpl'SP'plspl . ibd
-rw-rw---- 1 mysql my5ql 96K Aug 1 15: 50
ts # P#p2#SPlp 25pO.ibd
1 mysql my5ql 96K Aug 1 15:50 IU5r/loca l/m Y5ql/data/test21
ts#PØp2KSP#p2sp1.ib d
)' at line 8
4.8 .4
-n
w eL { c}
·
.{, I.C ...
-.
mys q >>R E-
caAN
TTTAEML PU
pu' --eu (
-> b INT)ENGINEaINNODB
-> PARTITION BY LIST (b) (
-> PARTITION pO VALUES IN (1 , 3 , 5 , 7 , 9) ,
-> PARTITION p1 VALUES IN (0 , 2 , 4 , 6 , 8)
) ;
table rows: 1 ••
********* **** ************* * 2.
btbs
a--aw nanos
eoeLma
-n-n -P·
··e·· s ts
emst ·-<
p-azz
-
..
r w
<,‘ e ( U ec}
4.8.5
2. row
btb
a--a ems
nano
maw f
-e1
rpo
nr'··
··e·· t
li
-n
par
-
..
r QJ
3. row
a--a
btb ems
ano
maw
n-r zp
··e·· 84
e4
-
pa z n ..
7
4. row
tt
hua
.• -
an
n-em
ma··e f-l e
· EP
P
paE -•L
n
._'- -.
table rows: 986937
5. row
t teoe
ta-La ems
ano
maw
n-E
hu+--hu EP9
··e··
P&Qd'··
-
p aE n ..
ro
6. row *.*********************.**.
t-btb
leoe
ti-
ta--a n-zems
ano
maw zp7
··e·· f
i f
}
' ero
AAM-
-n
nraE ..
7. row ***************************
·Dtb
a--a
eoe ems
nano
maw EP9
··e··
PQ f--f
-n
pau E
-
..
.. z d
t
8. row ***************************
btb
aLa
eoe --e··
ems
nano
maw z .• e9
nrAy
-
par n p7
-
r
*.************************* 9. row
a-La
eoe ems
nano
maw -
.. EPO -
.• e2d
- li
-n
pa E e·
-
r ·
*************.************* 10. row ***************************
btbw
tttz emse
n mawspqd{
EP80
··e··t e8
-
ao
r n
-
..
En
--
L s e c}
ref: const
rows: 1
Extra:
1 row in set (0.00 sec)
--
..{,I. CA
4.8.6
TABLE … EXCHANGE
TABLE … EXCHANGE
CREATE TABLE e (
id INT NOT NULL ,
fname VARCHAR(30) ,
lname VARCHAR(30)
+----…----------+ ------------+
4 rows in set (0.00 sec)
+---------…------+ ------------+
I PARTITION_ NAME I T ABLE_ ROWS I
+----------------+ ------------+
nrnv
nvn
+----------------+ ------------+
4 rows i n set (0.00 sec)
+----+-------+-----…+
I id I fname I lname I
+----+-------+----- - -+
I 16 I Frank I Whit e I
+----+-------+----- - -+
1 row in set (0.0 0 sec )
...
4.9
C...
5.1
.{,I. CA
s
5.2
5.2.1
- OU I AY l l AO eJ
,,
CJ Z
a··EE
--
ll
p323- -ll
hyhyll "+-m
5.2
5.2.2
/\
2
/\ \
5 8
6.
1+ 2+3+4+5+6 )
1)
._'V
3
\
3
\
,6
/ \
/ ' "'"
j ' \ j \
/ \
yd
IJL
/ -\
2
,
"
9
C...
5.3
5.3.1
Leaf Index
No No
Index
Yes No
Page
C...
53 189 @
Page
| 25 I I I
28 30
C...
..
5.3.2
No No
Yes No Page
1
Yes Yes Page
5.4 1914b
Fill
5.4
B+
. --.
C...
2 ,..._.
,..._.
index)
5 .4 .1
CREATE TABLE t (
a I NT NOT NULL ,
b VARCHAR(8000) ,
c I NT NOT NULL ,
PRlMARY KEY (a) ,
KEY idx c (c)
)ENGINE= INNODB ;
page
OOOOcOOO c2 33 6 2 95 00 00 0 0 03 ff ff ff ff ff ff ff ff I . 3b. . . . . . . . . . . . . I
0000c010 00 00 00 Oa b6 8c c e 57 45 bf 00 00 00 00 00 00 I . . . . . . . WE. • • . • • • I
0000c020 00 00 00 00 00 f9 00 02 00 a2 80 05 00 00 00 00
0000c030 00 9a 00 02 00 02 00 03 00 00 00 00 00 00 00 00
0000c040 00 01 00 00 00 00 00 00 01 e2 00 00 00 f9 00 00
0000c050 00 02 00 f2 00 00 00 f9 00 00 00 02 00 32 01 0 0 I • . . . • . . . . . . . .2. . I
0000c060 02 00 lb 69 6e 66 69 6d 75 6d 00 04 00 Ob 00 00 I . . . infimum . . . . . . I
0000c070 73 75 70 72 65 6d 75 6d 00 1 0 00 1 1 00 Oe 80 00 Isupremum.. ...... I
0000c080 00 01 00 00 00 04 00 00 00 19 00 Oe 80 00 00 02
0000c090 00 00 00 05 00 00 00 2 1 f f d6 80 00 00 04 00 00
OOOOcOaO 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00
OOOOcObO 00 00 00 0 0 00 00 00 00 00 00 0 0 00 00 00 00 00
OO OOcOcO 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
6e 66 69 6d 75
6d 0002 00 Header ,
Page
00 00
Ox0001) , 8000
0003
00 04 I I
(' ( ‘ a' 4 ,repeat
3,repeat (‘ a'
.tt I. e ....
5.4
mysql>EXPLAIN
-> SELECT * FROM Profile ORDER BY id LIMIT 10 \G;
******************* ******** 1. row ***********.******* ********
id: 1
select_type: SIMPLE
t able: Profile
type: index
possible ke ys : NULL
key: PRlMARY
key_len: 4
ref: NU LL
rows: 10
Extra:
1 row in set (0.00 sec)
query)
mysql> EXPLAIN
-> SELECT * FROM Profile
-> WHERE id>10 AND id<10000\G;
1. row
id: 1
select_type: SIMPLE
table: Profi1e
type: range
possible_keys: PRlMARY
key: PRlMARY
key_len: 4
r ef: NULL
rows: 14868
Extra: Using where
1 row in se t <0.01 sec)
d
., I.C.6
COU NT(l): 99 46
1 ro w in set (0.00 s ec )
5.4.2
Clustcrcd Indcx
5-15
5.4
SQL
Identifiedr , RID)
SQL SQL
ahead)
It all
N nkiuodsd OP-aA2NNB
-enml·-uec
IA
RUUT
MLRv‘ LE
LL
RS
qe
quecc -l-aa-a-m
o aI
2. row
-umemotzelpn
bqadai--akuvde
t111CA2NNB
Tn-LEaa-am
a--nnntlpcNtm
eeexenytdlet
N qoaz
uy-nlnbipxo
nkiuodsd
-enml·-uec
dXU
C L U
L T
R
E
-LLE
cdecc
_ inno d b _p age
00010000 b9 aa 8e dO 00 00 00 04 ff ff ff ff ff ff ff ff
00010010 00 00 00 Oa ec ea 4e 27 45 bf 00 00 00 00 00 00 1. . .. . .N ' E....... I
00010020 00 00 00 00 01 02 00 02 00 ac 80 06 00 00 00 00
00010030 a4 00 01 00 03 00 04 00 00 00 00 00 52 d4 8b I • • . . • . . . . . . . . R. . I
00010040 00 00 00 00 00 00 00 00 01 f2 00 00 01 02 00 00
00010050 00 02 02 72 00 00 01 02 00 00 00 02 01 b2 01 00 I. . .r . . . . . . . . . . . . I
00010060 02 00 41 69 6e 66 69 6d 75 6d 00 05 00 Ob 00 00 I . • Ainfimum. . . . . . I
73 75 70 72 65 6d 75 6d 00 00 10 ff f3 7f ff ff Isupremum . .. . .... I
00010080 ff 80 00 00 01 00 00 18 ff f3 7f ff ff fe 80 00
00010090 00 02 00 00 20 ff f3 7f ff ff fd 80 00 00 03 00
000100aO 00 28 ff f3 7f ff ff fc 80 00 00 04 00 00 00 00 1. (..... .. .. .. ... I
00013ffO 00 00 00 00 00 70 00 63 f 3 46 77 f2 ec ea 4e 27 I . . • . . p . c . Fw. . . N I I
11 Key:7f ff ff fe 11 Key:7f ff 11 Key:7ffffffc
11 11 Pointer. 80 00 00 03 11
Key:80 00 00 01 Key:80 00 00 02
Pointer:OO 05 Pointer. OO 06
5.4.3
Pl:
P2:
5.4 20/ - .
LAST-INSERT ‘ UJ
Y
o PAGE_DlRECTION
o PAGE N DlRECTION
• Page
cursor record splil rccord
II II II I 1 :
I I I II I: I
I I I I : I
…I I
…
I I
.
: I
•
I I I I I
I I I I : I
record 10 be insert
split
Page Ri gblPage
cursor record
record 10 be insert
-.
..{) I. CA
._'-
Page
cursor record
record
record 10 be insert
After Splil
Page
Righl Page
cursor record
splil record
record 10 be insert
5.4.4
CREATEIDROP
CREATE [UNIQUE] INDEX index name
[index_type]
ON tbl_name (index_col_name , ...)
-
a
-
m
2 . row
Table: t
Non_unique: 1
Key_name: idx_b
Seq_in_ index : 1
Column name: b
Collation: A
Cardinality: 2
Sub_p art: 100
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
3. row
Table: t
6.{, I.CA
..'-
LLE
x
e
4. row
Tn- .......
-um
bqada
eeetlL2C
ainnntlpcNtm
uy
nkiu
-e
d
Xa U U
c L
-
qu ecc - emotzelpn
l-aa x.
nml·-uec
-
nlnbpxo ................
enytdlet
odsd ---La A
2NNB
LLE
-am
kuyeLR
T PM
5. r ow
Tn lumem
bqada
t
a--nnn
eee
uy-n 1·llc
nkiu
-enm
dx c
-i
sec x
e
Collation: A
Cardinality: 2
SUb_part: NULL
Packed: NULL
Null :
Index_type: BTREE
Comment:
5 r o ws in set (0.00 sec)
INDEX
CJ
5.4
•••
o
in_ a
o Column
Table: t
Non_unique: 0
Key_name: PRlMARY
Se q__ in_index: 1
Column name: a
Collation: A
Cardinality: 4
SUb_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
U ..
Packed: NULL
Null:
Index_type: BTREE
Comment:
....
SQL
Index Creation
openarkkit toolkit
o
-.
.{) I. CA
._'-
o
o
sql_bin
4.0nline DDL
DDL
C...
5.4
(1) NONE
(2) SHARE
.{, I.C...
(3) EXCLUSIVE
(4) DEFAULT
online_ alter_log_max_
_online_ alter_log_max_
5.5
5.5.1
SELECT * FROM student WHERE sex='M'
possible_keys: usernick
v-e
-Kel e2z n --e k
··nu euro
bA e va
-
ref: const
rows: 1
Extra:
1 row in set (0.00 sec)
C...
5.5.2
lNSERT
modified
.{)I.C...
5.5
P2. …. P8 0
(P l+P2+ …+P8)
• 1 A
•
2 A E
,
, A 2ol2 l:1:li -
' A 2OJ2
,
,, .....10
'‘
=- 8TRU
-"'11) 8TÆf
'‘
INDEX FROM
: T.. IU
• ' "
2 A 21 S2
: A lZ!lI C22II
1
' cm
8TREf
' A
CIIII
INDEX FROM
_ stats_sample
_ unequal , nulls_
_
stats
TABLE INDEX
InnoDB
innodb_stats_pe rsistent
OFF
TABLE
OFF
_stats
innodb_ stats_persistent_sample_p ages
20
sample
innodb_stats_transient_sample_pages
8
.. {, I.e....
M
5.6
5.6.1
Think Differento
5.6.2
.{, I.C ...
.
1.
userid , buy_
. ."'....……………….. e.cr. ..
...._...……
.. 1 SINPLE ,.., 4 3
buy_
Þ
C...
218
b,
SELECT .•. FROM TABLE WHERE a=xxx ORDER BY b
SELECT •.. FROM TABLE WHERE a=xxx AND b=xxx ORDER BY c
5.6.3
COUNT
buy_
! """ -
5.6 .4
..\I , CA
INDEX
FROM
..
•. •
2 A 2311 8 TRfE
1 00det!D A 8TREE
a.-O A lZIlII
A 177 lZIlII CDJ
!..j j ... 1 1 f'IociJcIlD A 177 aTREe
• {' 4 1155
table scan)
..{)
5.6
I ! íd _keys key
I •
5.6.5
HINT:
o
CREATE TABLE t (
a INT ,
b INT ,
KEY (a) ,
KEY (b)
)ENGINE=INNODB;
intersect
-
t All a 5
.'i
INOEXo
5.6.6 Multi-Range
Read
ref,
._'- -.
..{)I.CA
.......
b j1 sm 4
index
Read 43.213
4.212
Multi-Range
SELECT * FROM t
1, key_part2
1000) , (1 001 ,
1000) , (1002 , 1000) ,…, (1 999 ,
1----.
. .Pt---…--"'-- ‘…
Multi-Range
_
_ cost_
mrr cost
256K:
--.
Index Condition
Condition
Condition
Index Condition or
Condition
index
NDB Condition
Pushdown ,
Cluster
Condition
last_name ,
SELECT * FROM people
WHERE zipcode = ' 95054 ,
AND l astname LIKE
AND address LIKE ' %Main
index
Condition
MySQL Condition
MySQL5.5
MySQL 5.6 with ICP
MySQL 5.6 with ICP & MRR
Condition
5.7
5.7.1 ••
1,…,
T [O..m-l
[k] =NULL
h( K ,)
h( K.)
K,
K =h( K s )
K,
K
h(k) e k mod m
5.7.2
.{,I. CA
s
_ buffer_p ool_
space_ id<<20+space
5.7.3
* FROM TABLE
WHERE index col=' xxx ' ENGINE
INNODB
mysql>SHOW ENGINE INNODB STATUS\G;
1. row
Status:
=====================================
090922 11:52:51 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 15 seconds
------------…----------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 2249 , free list len 3346 , seg size 5596 ,
374650 inserts , 51897 merged recs , 14300 merges
Hash table size 4980499 , node heap has 1246 buffer(s)
1640.60 hash searches/s , 3709.46 non-hash searches/s
5.8
non-hash searches:non-hash
_adaptive_hash_
5.8
5.8.1
Text
5.8.2
file
file
inverted file
Number Text Documents Number Text Documents
code 1, 4 8 3, 6
2 days 3, 6 9 pease 1, 2
3 hot 1, 4 10 1, 2
4 m 2, 5 11 pot 2, 5
5 It 4, 5 12 some 4, 5
6 like 4. 5 13 the 2, 5
7 nme 3, 6
file inverted
(Documentld ,
full inverted
Number Text Documents Number Text Documents
code (1:6) , (4:8) 8 old (3:3) , (6:3)
2 days (3 :2) , (6:2) 9 pease (1 :1 ,4) , (2: 1)
3 hOI (1 :3) , (4:4) 10 porridge (1:2,5) , (2:2)
4 m (2:3) , (5:4) 11 pot (2:5) , (5:6)
5 11 (4: 3,7) , (5:3) 12 some (4:1 ,5) , (5: 1)
6 Iike (4:2 ,6) , (5:2) 13 the (2:4) , (5:5)
7 mne (3 :1) , (6:1)
full inverted : 6) ,
inverted
5.8.3
inverted index
Auxiliary Table
Auxiliary
Index Cache
FTS Index
2'34 $
Auxiliary ""'Table
Index
Table:
mysq l >SET GLOBAL innodb_ft_aux_table = 'test/fts_a';
Query OK , 0 rows affected (0.00 sec)
FT
INDEX
Index
Index Table
Index
FTS lndex
Index
UNSIGNED NOT
- > );
ERROR 1166 (42000): 1ncorrect column name 'FTS OOC 10'
DOC
column name
Cache
Document
Document
.{, I.C...
2'36
OPTIMIZE
_ optimize_ fulltext_
ft_num_word_
a:
CREATE T ABLE fts a(
FTS OOC 10 BIG1NT UNSIGNEO AUTO 1NCREMENT NOT NULL ,
body TEXT ,
PRIMARY KEY(FTS OOC 10)
);
I FTS_DOC_ IO I body
+----…------+---------------------…-------------------+
5.8
+------------+------------------…------…-----------…-+
7 rows in set (0 . 00 sec)
n
rnysql> SET GLOBAL innodb_ft_au x _table= ' test/fts_ a';
Query OK , 0 r o ws affected (0 . 00 s ec)
rnysql> S ELECT • FROM inforrnation_schema .INNODB_FT_I NDEX_TABLE;
+----------+-------
I WORD
-------+-------……+-----------+---…._---+----------+
I FIRST_DOC_ID I LAST_DOC_ID I DOC_COUNT I DOC_ID I POSITION I
+----------+-------
code
-------+-----…._-----+-----------+---…----+----------+
751552535
cold
cold
days
days
days
hot •
hot
like
like
like
like
n l. ne
n l. ne
••
old
pease
pease ••
pease ••
porridge ••
,
porridge ••
porridge ••
pot
pot
l
sorne
sorne
2'38 5*
4 I 5 I 2 I 5 I ••
DOC
+-----…--+
I DOC_ID I
+--------+
7 I
+--------+
1 row in set (0.00 sec)
+---------…-+-----
I Table I Op
-----+------…-+… -----…--+
I MS9_ type I Msg_text I
+------------+----- -----+----------+-- --------+
I test .fts_a I optimize I status I OK
+------------+----- -----+----------+-- --------+
1 row in set (0.01 sec)
7 I
+…------+
5.8 239 4b
FT BEING
5.8 .4 ••
1. Natural Language
LANGUAGE
table: fts a
type: fulltext
possible_keys: idx_fts
key: idx fts
key_len: 0
ref: NULL
rows: 1
Extra: Using where
1 row in set (0.00 sec)
I count(FTS_DOC_ID) I
..' -..
+-------------------+
2 I
+----------…------+
1 row in set (0.00 sec)
mysql> SELECT
- > COUNT(IF(MATCH (body)
-> AGAINST ('Porridge' IN NATURAL LANGUAGE MODE) , 1 , NULL))
-> AS count
-> FROM fts a ;
+-------+
I count I
+-------+
2 I
+-------+
1 row in set (0.00 sec)
+--------…-+-…-------------------------------------+---…--------------+
I fts_doc_id I body I Relevance
+------------+--…------------------------------------+--------------------+
1 I Pease porridge in the pot 0.2960100471973419
2 I Pease porridge hot , pease porridge cold 0.5920200943946838
3 I Nine days old o I
4 I Some 1ike i t hot , some 1 ike i t cold 0
5 I Some 1ike i t in the pot 0
6 I Nine days old 0
7 I I 1ike hot and code days o I
+-…----…-+-----------------------------------------+--------------------+
7 rows in set
(0.01 sec)
‘() 1. t: ..
+----+-------------…------…-----…
i d I body
------……+------+
rl
+----+---…------------------------------------+…-----+
7 rows in set (0.00 s ec)
_ ft_ min_token_
token token
2. Boolean
BOOLEAN MODE
(body)
AGAINST ("'Pease pot"@30' IN BOOLEAN
+-…--------+-----------------------------------------+
I FTS_OOC_10 I body
+------------+----------------- - - ----------------------+
2 I Fease porridge hot , pease porridge cold
1 I Pease porridge in the pot
4 I Some like i t hot , some like i t cold
-x-
5.8 zt
Search:
mysql> SELECT fts _doc_id , body FROM fts_a
-> WHERE MATCH(body)
-> AGAINST ('"Pease pot" @30' IN BOOLEAN MODE)\G;
*************************** 1. row
fts doc id: 1
body: Pease porridge in the pot
1 row in set (0.01 sec)
+------------+------------…--------------------------+---------------------+
I fts _ doc_ id I body I Relevance
+------------+-----------------------------------------+---------- -----------+
1 I Pease porridge in the pot 1.2960100173950195
2 I Pease porridge hot , pease porridge 'cold
3 I Nine days old 0
4 I Some like it hot , some li ke it cold 0.27081382274627686
5 I Some like it in the pot 1 .431 4169883728027
6 I Nine days old 0
7 I 1 like hot and code days 0.13540691137313843
+------------+-----------------------------------------+------------- --------+
7 rows in set (0.00 sec)
mysql> fts_a
- > WHERE MATCH(body) AGAINST ('po*' IN BOOLEAN MODE);
+------------+-----------------------------------------+
FTS_DOC_ID I body
+------------+-----------------------------------------+
2 I Pease porridge hot , pease porridge cold
1 I Pease porridge in the pot
5 I Some like i t in the pot
+------------+--------------------…------------------+
3 rows in set (0.00 sec)
poto
+------------+-----------------------------……-------+
FTS_DOC_ID I body
+-…--------+-----------------------------------------+
I 4 I Some like it hot , some like it cold I
I 7 I 1 like hot and code days I
I 2 I Pease porridge hot , pease porridge cold I
I 5 I Some like it in the pot I
+…---------+-----------------------------------------+
4 rows in set (0.00 sec)
mysql> fts a
-> WHERE MATCH(body) AGAINST ('''1ike hot …IN BOOLEAN MODE);
+---------- - -+----------------- ----------+
FTS_DOC_ID I body
+------------+---------------------------+
247 ?"
#tÆ .lJ..
3. Query Expansion
knowledge
+----+-----------------------+--------------------------------…-------+
8 rows in set (0.00 sec)
Expansiono
5.9
C...
6.1
2'50
SQL
Microsoft SQL
SQL
6.2
6ft
6.2
lock latch
Lock
I!Iysq1.> SHOW
I Type I I Status
I lnn008 I I os_waits=5 I
I lnnoDB I I I
2 (8.83 sec)
INNODB
11UTEX;
_.
I Inn008
I InnoOB I
I
3 set (8.81 sec)
I count=S4.
os_yi e\d S2t.
I
I
ENGINE INNODB
count
spin lock
5pm_waUs
spin_rounds
os watls
os_yields _thread
05 wall IJmcs
2'52 $ •
LOCK
6.3
6.3.1
s
x
s
granularity
6.3
IS IX S x
15
IX
S
x
C...
..
ENGINE INNOOB
mysql> SHOW ENGINE INNOOB STATUS\G;
TRANSACTIONS
SH
JNNODB
trx id
trx statc
startcd
lrx_rcquestcd_lock_id
trx id : 7311F4
trx state: LOCK WAIT
trx started: 2010-01-04 10:49:33
trx_requested_l ock_ id : 7311F4 :96:3 : 2
trx wait started: 2010-01 -04 10:49:33
trx_ weight: 2
trx_mysql_ thread_ id: 471719
trx query: select • f rom parent lock in share mode
2. row
trx id: 730FEE
trx state : RUNNING
trx started: 2010-01-04 10:18:37
tr x_requested_lock_id : NULL
trx started: NULL
trx_we ight: 2
trx_ mysql _ thrcad_i d: 47 1718
trx_query: NULL
2 rows in set (0.00 sec)
parent lock in
share
lock id
lock trx id
lock mode
lock_type
lock table
lock index
lock_space id
lock_page
lock
lock data
*************************** 2. row
lock id: 730FEE:96:3:2
lock trx id: 730FEE
kk- dp
ooccc0100 XR··9321
oybdaaran
eeexeecas
mtanpp
..........•...
--
ot-
CYRO
Emp6{
ReMO
DSAO
l
tis-}k- - v
a r e-
·
p ns
c-}
· · e
ecqet
--
K
I
cks
-
di ··e
6.3
trx
lock
LOCK
blocking_trx_id
requesting_lock_id blocking_trx_ id
mysql> SELECT
r.trx_id waiting_trx_id ,
r.trx_mysql_thread_id waiting_thread ,
r.trx_query waiti ng_query ,
b.trx_id blocking_ trx_ id ,
b.trx_ mysql_thread_id blocking_thread ,
b.trx_query blocking_query
FROM information schema .innodb lock waits w
INNER JOIN information schema.innodb trx b
ON b.trx_ id = w.blocking_ trx_ id
INNER JOIN information schema.innodb trx r
ON r.trx_id = w.requesting_trx_id\G;
1. row ***************************
wwl-L-l
·Lnn-lnn-l-1
ttLKKew
aawoo--aztt-tt-s
xzuxrut
zhqrhqe
99nqqnn
-Lt·--LK
- -ee
--TU--LS
2
27·L17Le
·laz--az{
ddyddy0
1
-q--9
aceoo
bbl F
-
l ee lc
b
nu
6.3.2
nonlocking
SQL
Query
Version
Concurrency Control.
READ
, Session A
mysql> BEGIN;
Query OK , 0 rows affe cted (0.00 sec)
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
It Session B
mysq1> commit;
Query OK , 0 rows affected (0.01 sec)
BEGIN
SELECT • FROM
2
WHEREid= 1;
3 BEGIN
SET id=3
4
WHERE id - 1;
SELECT • FROM parent
5
WHEREid= 1;
6 COMMIT;
SELECT • FROM parent
7
WHEREid= 1;
8 COMMIT
6.3.3
o SELECT"'FOR UPDATE
LOCK IN SHARE MODE
SELECT'" FOR
LOCK IN SHARE
UPDATE , SELECT'"
LOCK IN SHARE
START
6.3.4
AUTO-INC
.{)I.C...
63
SELECT ,
insert-Iike
simple
simple insert.s simple DUPLl CATE KEY
bulk
bulk inserts
REPLACE...SELECT, LOAD DATA
mixed.mode
mixed-mode inserts INSERT INTO tl (cl ,c2) VALUES (S,'c').
fNSERT … ON DUPLl CATE KEY
I
o I
bulk inserts
5imple inserts
2
C...
,_'
6.3.5
BEGIN
2 DELETE FROM parent WHERE id=3;
3 BEGIN
lNSERT INTO child SELECT 2 ,3
4
(waiting)
'!JJI
Emp-6
CYRReM
DSA
·v·
••pa r en '
-
---k
343
l
o ..
2 . row
-kKE
o-
ct --di
··i
-
3B
B3AYPO
OC
-- dple
kk---kcks
OOCCCO1&OO
X
X
-
eek-KKCOCM
oybdaazan
eeexeecas
mtanpp-di
••••••••••••
-
REmp6{
o
CYRO
ReMO
D t
S- A -O
-tis
ooo--E ··9343 -
·
'
Y
p·e
en S
a rc }
cqet
--
K ····e
6.4
6.4.1
o Gap
Lock : Gap Lock+Record
Record
Next-Key
11.
)
(10 , 11 )
(11 , 13)
(1 3. 20)
(20 ,
[10 , 11)
[11 , 13)
[13. 20)
13)
13)
Lock ,
BEGJN;
SELECT • FROM t
2
WHERE a =5 FOR UPDATE:
3 BEGIN:
4 JNSERT JNTO t SELECT 4:
COMMIT:
5
6 COMMIT
Next-Key
Lock.
..'i I.CA
(3 ,
INSERT INTO z SELECT 8 , 6;
INSERT INTO z SELECT 2 , 0;
INSERT INTO z SELECT 6 , 7;
Gap
Problem
Lock:
COMMITTED
_locks_ unsafe_for_
READ
Next-Key Lock
Problem
Next-Key Problem
Phantom'
SQL
Phantom
SETSESSION
tx isolation='REAO-OMMITTEO';
2 BEGIN;
SELECT • FROM t
WHERE a > 2 FOR UPOATE;
3
………. I. row ...……
a:4
..{,I. CA
4 BEGIN;
5 INSERT INTO t SELECT 4;
6 COMMIT;
SELECT .. FROM t
WHERE a > 2 FOR UPDATE;
7
……….. …......
1. row
a:4
..........2. row •••••••••
a:5
READ
IN SHARE
BEGIN
mysql>SELECT * FROM z
2 WHERE b=4
LOCK IN SHARE MODE:
mysql>SELECT * FROM z
3 WHEREb=4
LOCK IN SHARE MODE;
mysql>INSERT INTO z SELECT 4,4;
4
mysql>INSERT INTO z
SELECT4,4;
5 ERROR 1213 (40001):Dcadlock found when
trying to get lock;try restarting transaction
6 #
6.5
6.5.1
.ttl , CA
Ti me
SET
@@tx_isolation='read-ncommitted';
SET
2
@@tx_isolation='read-ncommitted';
3 BEGIN;
mysql> SELECT • FROM
••••••••• 1.
4
a: 1
1 row in set (0.00 sec)
5 INSERT INTO t SELECT 2;
mysql> SELECT • FROM
row ••••••••••••
••••••••• J.
a: 1
6
……… 2. row
a:2
2 row in set (0.00
COMMITTEDo
REPEATABLE , Microsoft SQL COMMITTED ,
6.5.2
Ti me
2 SET @@tx_isolation='read-committed';
3 BEGIN BEGIN
mysql>SELECT • FROM t ;
4
a: I
I row in set (0.00 sec)
5 INSERT INTO t SELECT 2;
6 COMMIT;
mysql>SELECT • FROM t ;
••••••••• 1. row
a: I
7
row
a: 2
2 row in set (0.00
SQL Server)
Key
6.5.3
3)
4)
C...
6:5
Ti me
BEGIN;
into @cash
2 FROM
WHERE user = pUser FOR UPDATE;
SELECT cash into @cash
FROM account
3
WHERE user = pUser FOR UPDATE;
SELECT... FOR
e
m p?tt l. 6%
6.6
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
Next-Key
mysql>SELECT * FROM t;
C...
‘'
+---+
I a I
+---+
I 1 I
I 2 I
I 4 I
I 5 I
I 8 I
+--- +
5 r ows in set (0.00 s e c)
6.7
6.7.1
graph
••
Wait
wait-for
( tI ) -{ t2
wait-for
ø X
wait-fôr graph
••
6.7.2
PW=nr/2R
=
.ttl , CA
6.7.3
BEGIN;
mysql>SELECT • FROM t
WHERE a = 1 FOR UPDATE;
2 ………1. row ………… BEGIN
a: 1
1 row in set (0.00 sec)
mysql>SELECT • FROM t
WHERE a = 2 FOR UPDATE;
3 ……… 1. row …………
a: 2
1 row in set (0.00 sec)
mysql>SELECT • FROM t WHERE a =2
4 FOR UPDATE;
InnoOB
G
Table: c
Non_unique: 1
Key_name: b
Seq_ in_ index: 1
Column name: b
Collation: A
Cardinality: 0
Sub part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
1 row in set (0.00 sec )
CREATE TABLE t (
a I NT PRlMARY KEY
)ENG I NE =I nnoDB;
BEGIN;
2 BEGIN;
SELECT .. FROM 1
3
WHERE a = 4 FOR UPOATE;
SELECT .. FROM t
4 WHERE a <= 4 LOCK IN SHARE MOOE;
6.8
Microsoft SQL
284
6.9
SQL
..ftl.CA
.,'-
7.1
7.1.1
NDB
5)
C
I control
7.1.2
Flat Transactions)
-.
.{) I. CA
._'-
Transactions with Savepoints)
Chained Transactions)
Transactions)
Transactions)
Operalion K
COMMlTWORK ROLLBACK WORK
BEGINWORK
SI
7.1 289 .
Transactions with
WORK :
WORK :
WORK :
..{,I. CA
BEGIN WORK
I
Action
} ,
Action
SAVEWORK: 2
Action
Action
SAVEWORK: 5
Action
SAVEWORK: 6
Action
Action
SAVEWORK: 7
ROLLBACK WORK: 7
Action
Action
SAVEWORK: 8
Action
COMMITWORK
volatile) ,
••
T
T3
A A A C
Nested
level
C
. BEGINWORK
BEGIN WORK
, ,,
,,
BEGINWORK COM MIT WORK l 'i COMMIT WORK
-:
COMMITWORK
BEGINWORK
,,
, ,,
' /1 BEGIN WORK
,,,
( predecessor
Tk
81
811
812
8121
83
831
Commit
time
7. 1 293
_.
7.2
7.2.1 redo
Log at
2.
DELI MITER /1
PROCEOURE p _ load(count INT UNSIGNED)
BEGIN
DECLARE s INT UNSIGNED DEFAULT 1;
DECLARE c CHA R(80 ) DEFAULT REPEAT('a' , 80);
WHILE s 00
I NSERT I NTO test load SELECT NULL , c ;
COMMIT;
SET s = 5+1;
END WHILE;
END;
/1
DELIMITER ;
p_ load
mysql > SHOW VARI ABLES LIKE ' innodb_ fJ ush_lo9_at_t rx_commit '\G
1 . row
Variable_name : innodb_flu s h_l o9_at_trx_commit
Va lue : 0
1 row in set (0 . 00 sec)
_ flush_log_at_trx_
binlog
TI T4 T3 1'2 T8 T6 T7 T5
rcod log
2. 109 block
log
3
&
block
block
RcdoLog
LOG_B LOCK_HDR_NO
LOG_B LOCK_HDR_DATA_LEN
LOG_BLOCK_FIRSLREC_GROUP
Log Block
512 Bytes
LOG_BLOCK_CHECKPOINT_NO
LOG_B LOCK_TRL_N O
block
block
log block
log
z2 299 %
LOG
Tl 270 bytes
Free
log block
REC
log block
l09 block
log group
log group
log
log log
log
log
log log
log
log file ,
redo 109
log
7.2
log log
log
log
LogGroup 1
Lo g Group 2
Redo Log Filel
log log
filer
| I | I
..ftl.CA
.,'-
log
MLOG_REC_INSERT
Icn& i oriein i mis_malc I
cxtra info inlo_bils! ! I rcc body
MLOG_REC_DELETE
5. LSN
Sequence
PAGE
7.2
ENGINE INNODB
mysq1> SHOW ENGINE INNODB STATUS\G;
LOG
Last checkpoint
LOG
10000 ---
redo 10g
| I I
Buffcr Pool
checkpoint LSN:
f(f(x)) =f(x)
..{,I. CA
7.2.2 undo
segment) 0
DELETE ,
undo
2.
log log
segment
PAGE TYPE
_ undo_directory
_ undo_ tablespaces
_ undo_
rollback
7.2
_undo
_rollback_
_undo_
I Variable name I Va l ue I
| -L
-LL-E
||
nnn-w
AUAU
000-s
----noa
bbb-iddd
uuu-
000-tce
dit-{
l Eqdb
nnn- es-
op-v lll+
ra
a
00
AU Ce s-
+3 - - ---- ---- - +
se o Oo s e e}
+--------------+-----------…._-----------------+
I var i ab1e namel Va 1ue
+- - - - - ---- -----+--------- - ------- --------------+
I datadir I /users/david/mysq1_data/dat a/ I
+--------------+-------------------------------+
1 row in set (0.00 sec)
segment
log
.{, I.C ...
log ,
TRANSACTIONS
History list
History Iist
3.
undo log
o update undo log
insert undo
undo
z2 3 0.19
undo
undo
undo table
update undo
undo
.lenN colN
;·"s;·lcn
start I stan
o 13 delete
o 14 TRX UNDO DEL MARK
_ update_
SQL
+--------------------+---------------------+
I Field I Type
--…--+…--+……----+-------+
I Nul l I Key I Default I Extra I
+------------+-…----+---------+ nunU
<
U
TRX
CREATE TABLE t (
a INT ,
b VARCHAR(32) ,
PRlMARY KEY (a) ,
KEY(b)
)ENGINE- InnoDB;
mysql> TBEGIN;
Query OK , 0 rows af fe cted (0.00 sec)
ro -L
-
und
-
ec
-
..
n
u dhMo
lt--ae'US
r Lspqf
ryzce···
pee
!-- ··
·u
·D -
N
{ Ns e
qMFuRT REC TA
-w
'··nu
·
not
-
e ea
se
t nu C
C...
3 12
0 1 1c Ob 00 16 04 80 00 00 01 01 10
01 1c
Ob II undo
00 II undo
16
04
80 00 00 01
01 10 # undo 272= Ox0110
undo
mysql> COMM1 T ;
Query OK , 0 rows affected (0.00 sec)
segment_id: 2
insert undo list : 0
inser t undo cached: 1
1 row in set (0.00 sec )
mysq1> BEGIN;
Query OK , 0 rows affected (0 . 00 sec)
roqd
-c
und e
-
undo_rec_ type: TRX_UNDO_DEL_ MARK_REC
size: 37
space: 0
page_no: 326
offset: 620
1 row in set (0 . 00 sec)
0518260 00 00 00 00 00 00 00 00 00 00 00 00 02 91 Oe 00
0518270 16 00 00 00 00 30 01 eO 82 00 00 01 4e 01 10 04
0518280 80 00 00 01 00 Ob 00 04 80 00 00 01 03 01 31 02
0518290 6c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 91
Oe
# undo no
16 id
00 # info bits
00 00 00 30 01 eO #
82 00 00 01 4e 01 10
..ttl.CA
--.
04
80 00 00 01
00 Ob
00
04
80 00 00 01
03 -
01
31 1
02 6c
mysql> COMMIT;
Query OK , 0 rows affected (0.00 sec)
mysq1> BEGI N;
Query OK , 0 r ows affected (O.OO sec )
er
zo
-c
u nd e ..
undo_rec_ type: TRX_ UNOO_ UPO_ EXI ST_REC
size : 4 1
space : 0
page_ no: 3 18
offset : 724
1 row in set (0.00 sec)
0 4 f82dO 00 00 00 00 02 fd Oc 00 16 00 00 00 00 32 04
04f82eO 8 4 0 0 00 0 1 4 8 01 10 0 4 80 00 0 0 01 01 03 01 31
04f82fO 0 0 Ob 0 0 04 80 00 00 01 03 01 3 1 0 2 d4 00 00 00
02 fd
Oc
undo
16 tab1e id
00 # i n fo bits
00 00 00 32 04 e O trx id
84 00 00 01 48 01 10 :#
04
80 00 00 01
01 #: upda t e
03 :# update
01 :# update
31 1'
00 Ob
00
04
80 00 00 01
03
31 ••
02 d4 # undo
_ UNDO
log 0 undo_
rec
4‘
6ft
7.2.3 purge
history
logo
..ttl.CA
History List
trx7
list
_p urge_ batch_
undo
history
_ max_purge_lag_delay
innodb_ max_purge_lag_
group
1
.'i I.CA
2)
3)
_
innodb_fiush_log_at_trx _
B na ZLOob
Session Server Enginc
COMMIT
prepare
… ….
wnle
commlt
I OK
_ commit_
_ commit_
TI T2 T3 Binary Log [nnoDB
Prcparc
Prepare
Prcparc
Write@
Writc@200
Write @300
| I Commit I
|comlnit|
Commit
Write@
Commit
Preoarc
WrÌlc@300
Prcpare
Writc
Commit
Facebook
6 "".-
_commit_
Log Group Co mmit
MySQL 5.6
MySQL5.6
o
_commit_
group
group
‘, I.C ....
7.3 ••
o STARTTRANSACTION I
o
identifier :
SAVEPOINT identifier
TO[SAVEPOINT]
TO
TRANSACTION
READ
REPEATABLE
3'2 4 _'"
START
COMMIT AND
mysql> BEGIN;
Query OK , 0 rows affected (0 . 00 sec)
mysql> ROLLBACK;
I. Cø _
7.3
_
TRANSACTION)
_type
COMMIT INTO t SELECT
COMMIT AND
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
1. row
aevr
eo
EH --
n ··s5t
s on ,.• ·
RJnu
a"1· os
34
-nu qde
-l e <
U c}
_ COMMIT WORK
2006
has gone
TO
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
mysql> BEGIN;
Query OK , 0 rows affected (0.00 sec)
I a I
+---+
I 1 I
I 2 I
+---+
2 rows in set (0.00 sec)
.". -..
mysql> ROLLBACK;
Query OK , 0 rows affected (0.00 sec)
ym
mE qt
sp > se
ly L rur v Re
*nu
mA· OCt .,
M}
‘
s ‘
nu S
TO SAVEPOINT
ROLLBACK TO SAVEPOINT
7 .4
ANALYZE
Microsoft SQL
SQL
TRUNCATE TABLE
.tt l. e ....
mysql> BEGIN;
Query OK , 0 rows affected (0.01 sec)
mysql> ROLLBACK;
Query OK , 0 rows affected (0.00 sec)
7.5
Per Second ,
autocomrnit= 1)
a: 1
2. row
a: 2
3. row
a: 3
3 rows in s et (0.00 sec)
7.6
UNCOMMITTED
o READ COMMITTED
o REPEATABLE READ
o SERIALIZABLE
331 .
READ
READ 0 REPEATABLE
SQL Server
READ UNCOMMITTED
I READ COMMITTED
I REPEATABLE READ
I SERIALIZABLE
[mysqld)
transaction-isolation = READ-COMMITTED
IN SHARE
Iock ,
READ
mysql> BEGIN;
.{, I.e_
7.6 ...
mysq1> BEGIN;
Query OK , 0 rows affected (0 .00 sec)
t Session B on master
mysq1> BEGIN;
Query OK , 0 row s affected ( 0 . 00 sec)
mysq1> COMMIT;
Quer y OK , 0 rows affected (0 . 00 s ec)
* Se s s i on A on maste r
mys q 1 > COMMIT;
Query OK , 0 rows affected (0.0 0 sec)
, S1 ave
mys ql > a;
Emp ty set (0 . 00 sec )
7.7
7.7.1
t Bank@Shanghai:
UPDATE account SET money = money - 10000 WHERE user='David';
• Bank@Beijing
UPDATE account SET money = money + 1 0000 WHERE user='Mar i ah';
.{,I. CA
d
(Transaction
lNSERT.UPDTE.
DELETE.
SELECT
Two-Phase Commit
XA ROLLBACK xid
XA RECOVER
mysq1> XA RECOVER\G;
1. row
formatID: 1
gtrid_length: 1
bqual_length: 0
data: a
1 row in set (0.00 sec )
(Java Transaction
..{) I. CA
d
import java.sql.Connection;
import javax.sql.XAConnection;
import javax.transaction.xa.*;
import com.mysql.jdbc.jdbc2.optional.MysqlXADataSource;
import java.sql.*;
public MyXid() (
thia.formatld = formatld;
this.g trid = gtrid;
thia. bqual = bqual;
r.turn formatld;
return bqual;
return gtrid;
String passwd) (
try {
MysqlXADataSource ds : ne. MysqlXADataSource();
ds.setUrl(connString);
dS.setUser(user);
ds.setPassword(passwd);
r.turn ds;
catch(Exception e) (
System.out.println(e.toString());
return null;
stmtl.execute("
UPDATE account SET money :TWJ
WHERE user='david'"
xaResl.end(xidl , XAResource.TMSUCCESS);
i f ( retl == XAResource.XA OK
&& ret2 == XAResourc e .XA_ OK ) {
xaRe sl.commi t(xidl , falsa);
xaRes2.commit(xid2 , false);
lcatch(Exception e) {
e.printStackT race();
catch (Exception e) {
System.Out.println(e.toStri ng());
7.7.2
-,.
••
innodb sJave
slave
7.8
7.8.1
CREATE PROCEDURE load1(count INT UNSIGNED)
••
BEGIN
DECLARE 5 INT UNSIGNEO OEFAULT 1;
DECLARE c CHAR(80) OEFAULT REPEAT('a' , 80);
WHILE 5 <= count 00
INSERT INTO t1 SELECT NULL , c;
COMMIT;
SET 5 = 5+1;
ENO WHILE;
END;
mysql> BEGIN;
Query OK , 0 rows a ffected (0.00 s e c)
mysql> COMMIT;
Query OK , 0 rows affected (0.03 sec)
Too
7.8.2
C...
..
TRANSACTION ,
_
AUTOCOMMIT=
C
Python
7.8.3
*************************** 1. row
Table: b
Create Table: CREATE TABLE 'b '
'a' int(ll) NOT NULL DEFAULT '0' ,
PRlMARY KEY ('a')
ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql>SELECT * FROM b;
Empty set (0.00 sec)
_auto_rollback_
_auto_rollback_
-1: - 1 't'.. ••
1 row in set (0.04 sec)
mysq1>SELECT * FROM b;
Empty set (0.00 sec)
SQL
Microsoft SQL XABORT
SQL
Microsoft SQL
_rollback_ _ auto_rollback_
_auto_rollback_ _rollback_
t! /usr/bin/env python
impor t MySQLdb
‘() 1. t: ..
M
try :
conn&
MySQLdb . connect (host-"192. 168 . 8 .7" , user="root" , passwd=" xx" , db="test")
7.9
UPDATE account
SET account total - account total + (1 + interest rate)
348
e1se
EXEC SQL SELECT 1ast ac count
INTO las t account done
FROM batchcont ext;
7.10
READ
C...
8.1
o Hot Backup
o Cold Backup
o Warm Backup
Hot
Backup 0 Cold
Backup Warm
8.1 351
SELECT*INTO
replication
slave/standby
( Database Admin
8.2
o
8.3
8.3.1 mysqldump
SQL
localhost Oatabase: t e st
TABLE
..
(-x)
CREATE DATABASE /*!32312 IF NOT EXISTS*/ ' test' /*!40100 DEFAULT CHARACTER SET
latinl */;
USE 'test';
[=value]
CHANGE
-- ----------…----------------------…----------------
-- Server version m
Rd Ed ''&
8.3
Q …events
1
(-T path)
--fields-enclosed-by=... , --fields-
where_condition' condition' )
(root@x en-server bin)' mysqldump -- single-transact ion --where e 'b>2 ' test a >
a.sql
-- b>2
SELECT. ..INTO
[LINES
[STARTING BY 'st ring ' )
[TERMINATEO BY 'string')
BY [[OPTIONALLY]
ENCLOSED BY 'char' [ESCAPED BY
BY 'string' TERMINATED BY
mysql> quit
Bye
[root@xen-server - ) . c at /home/mysql/a .txt
1 a
2 b
3 c
TERMINATED BY I string
mysql test - e " select * into out file ' / home/mysql/a.txt'
fields termina ted by ',' from a";
[root@xen-serve r ‘ ) , cat /home /mysql / a.txt
1,a
2, b
3, c
TERMINATED
[root@xen-servermy sql). mysql test -e "select * into outfile ' /home /mysql/a .txt '
fields te r minated by ', ' lines termina ted by from a";
INTO
DATA DATA
[REPLACE I IGNORE]
I NTO TABLEtbl name
[CHARACTER SET charset_name]
[ (FIELDS I COLUMNS)
[ TERMINATED BY ' string ')
[[ OPTIONALLY] ENCLOSED BY 'char']
[ESCAPED BY ' char' ]
[LINES
[STARTING BY 'string' )
[TERMINATED BY ' string ']
DATA
INTO number L1NES
DATA
mysql>CREATE TABLE b (
->a INT ,
- >b INT ,
->c I NT ,
.{)I.CA
--.
mysql>SELECT * FROM b;
I a I b I c
+ ---+------+------+
I 1 I 2 I 3 I
I 2 I 3 I 5 I
I 4 I 5 I 9 I
I 5 I 6 I 11 I
+---+ ------+------+
4 rows in set (0.00 sec)
8.3.5 mysqlimport
DATA DATA
DATA
DTA
.{,I. CA
8.4
[mysqld]
log-bin=mysql-bin
d lns
s-co
libb
movdn
yqnn
qb-d
nl = mqp i--
s q -ba
vdo .• n=
X
lu =
rt -A
-
shell>mysqlbin l og- - start-pos ition= 107856 binlog . 0000001 r mysq l -uroot -p test
8.5
8.5.1 ibbackup
SQL
368 . --.
'"
....
8 .5 .2 XtraBackup
, ./xtrabackup --backup
./xtrabackup Ver alpha-0.2 for 5.0.75 unknown-linux-gnu (x86_ 64)
>>loq 8canned up to (0 1009910580)
Copying ./ibdata1
to /horne/kinoyasu/xtrabackup_work/mysql-5.0.75/innobase/xtrabackup/tmp2/ibdata1
. .done
Copying ./tpcc/stock. i bd
to /home/kinoyasu/xtrabackup_work/rnysql-5.0.75/innobase/xtrabackup/trnp2/tpcc/
stock.ibd
. .done
Copying ./tpcc/new_orders.ibd
to /home/kinoyasu/xtrabackup_work/mysql-5.0.75/innobase/xtrabackup/trnp2/tpcc/
new orders.ibd
. .done
Copying ./tpcc/his tory .ibd
to /home/kinoyasu/xtrabackup_work/mysql-5.0.75/innobase/xtrabackup/tmp2/tpcc/
history.ibd
. . . done
Copying ./tpcc/custorner.ibd
to /horne/kinoyasu/xtrabackup_work/rnysql-5.0. 7 5/innobase/xtrabackup/trnp2/tpccl
customer.ibd
>>log scanned up to (0 1010561109)
. . .done
Copying ./tpcc/district.ibd
to Ihome/kinoyasu/xtrabackup_ work/mysql-5.0 . 75/innobase/xtrabackup/trnp2/tpccl
dìstrict.ibd
. . done
Copying ./tpcc/itern . ìbd
to /horne/k inoyasu/xtrabackup_work/mysql-5.0.75/innobase/xtrabackup/trnp2/tpcc/
item. ibd
dtopec
nc
.,
C p y .ln mHd
r , r deE
J
--nHe
24 -lb d
"9
o r deE line-ibd
>>10g scanned up to (0 1012047066)
. . . done
Copying ./tpcc/orders.ibd
to /home / k i noyasu/xtrabackup_work /mysq1 - 5.0.75/innobase/ x trabac kup/tmp2/tpcc/
orders.ibd
. . .done
Copying ./tpcc/warehouse.ibd
to /home/kinoyasu/ x trabac kup_ work/mysq1-5.0.7 5/innobase/x trabackup/tmp2/ tpcc/
warehouse.ibd
. . . done
>>10g scanne d up to (0 1014 592707)
Stopping 10g copying t hread..
Tr ans a c ti on 109 of lsn (0 1009910580) t o (0 1014592707) was cop i ed .
(0
8.5.3
( full backup)
I ./xtrabackup --backup -- target-dir: /backup/base
(incrementa1 backup)
I . --target-dir=/backup/d e1ta --incrementa1-basedi r : /
backup/base
MASS!;?%
••
(pre pare)
, ./xtrabackup - - prepare --target - dir;/backup/b ase
t ./xtrabackup - -backup
./xtrabackup Ver beta-0.4 for 5.0.75 (x86 64)
>>log scanned up to (0 378161500)
The 1atest check point (for increme nta1): ' 0:377883685 '
>>log scanned up t o (0 379294296)
Stopping 10g copying thread..
Transaction 10g of lsn (0 377883685) to (0 37 9294296) was copied.
The 1atest check point (for increme nta1): ' 0:379438233 '
8.6
Volume
Manager ,
Logical Volumcs
Ivcreate
t
vgcreate
û L Volurne Group
VGO
-
(root@nh124 - 98 -)t vgdisplay
--- Volume group
VG Name rep
System 10
Format lvm2
Me tadata Areas 1
Metadata Sequence No 1873
VG Access read/wr ite
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size 260.77 GB
PE Size 4.00 MB
To tal PE 66758
Al loc PE / Size 66560 / 260.00 GB
Free PE / Size 198 / 792.00 MB
VG UU10 MQJiye-j4NN-LbZG-F3CQ-UdTU-fo9D-RRfXD5
volume
LV Name /dev/rep/dho_ datasnapshot1 00805143507
VG Name rep
LV UUID fSSXzh-I BnZ-aZln-eP03 -b7pk- CPjN-5xUktE
LV Write Access read only
LV snapshot status active destination for /dev/rep/repd ata
LV Status available
, open
LV Size 100.00 GB
Current LE 25600
COW-table size 80.00 GB
COW-table LE 20480
Al located to snapshot 0.13%
Snapshot chunk size 4.00 KB
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
--permlsslon
[root@nhl19-215 data)' lvcreate --size l OOG --snapshot - -permission r -n
datasnapshot Idev/rep/repdata
Logica l vo l ume "datasnapshot" created
Allocated to
lvdisplay
--- Logical
LV Name Ide v /rep/dho_datasnapshotl00805163504
VG Name rep
.,
._'- -.
I. CA
8.7
8.7.1
replication
1
I. c.
...... ...
....
··\
Id : 1
User: system user
Host:
db: NULL
Connect
T i me: 6501
State: Waiting for master to send event
1nfo: NULL
2. row
1d: 2
User: system user
Host:
db: NULL
Command: Connect
T ime: 0
State: Has read all relay log; waiting for the slave 1/0 thread to update it
1nfo: NULL
3. row
1d: 206
User: root
Host: local host
db: NULL
Command: Query
Time: 0
State: NULL
1nfo: SHOW FULL PROCESSL1ST
3 rows in set (0.00 sec)
..
65. row
Id : 26541
User: rep
Host: 192.168.190.9 8 : 39549
db: NU LL
Command: Binlog Dump
Time: 6857
State: Has sent all binlog to slave; waiting for binlog to be updated
1nfo: NULL
SLAVE MASTER
mysq1>SHOW SLAVE STATUS\G;
1. row ********************* * *****
S1ave_IO_State: Waiting for master to send event
Master Host: 192.168.190.10
Master_User: rep
Master Port: 3306
Connect_Retry: 60
Master_ Log_Fi1e: mysq1-bin.000007
Read_Mas ter_Log_Pos : 555176471
Re1ay_ Log_Fi1e: gamedb-re1ay-bin.000048
Re1ay_Log_Pos: 224355889
Re1ay_Master_Log_Fi1e: mysq1-bin.000007
Slave_ IO_ Running: Yes
Slave_SQL_ Running: Yes
Rep1icate_Oo_OB:
Replicate_Ignore_OB:
Rep1icate 00 Tab1e:
Rep1icate_ Ignore_Tab1e :
Rep1icate_ Wi1d_ 00_Table:
Rep1icate_Wi1d_Ignore_Table:
Last Errno: 0
Last Error:
Skip_Counter: 0
ExeC_Master_Log_POS: 555176471
Relay_ Log_Space: 224356045
Until Condition: None
Until_Log_File:
Until_Log_ Pos: 0
Master SSL A110wed: No
Master SSL CA Fi1e:
SLAVE
••
SHOW SLAVE
Slave 10 Statc
Mastcr_Log_F ilc
bin.OO0007
Relay
Relay_Log_F ile
Re1ay_Log_Pos
Slave_ 10_ Running
Slave_SQL_Running
Read_Master_Log_Pos - Exec_
Exec_ Master_Log_ Pos Master_ Log_Pos
MASTER
mysql>SHOW MASTER STATUS\G;
1. r ow
File: mysql-bin . 000007
BLOM
nqqqd-
Position : 606181078
Doe
- -
D-(
oEt nununu
l
nE
B1
o
-i
nse au- · ·
nu qu ec}
_Master_Log_
8 .7.2
381 9
--……---------------…- ---……- -- -
, ‘
', -
•• ••
,., T
....
J
•••••••••
;:/
,
;_-:- 7.... . .- ..... ‘ -
-;. ":'
382
••
(mysqld)
read-only
8.8
.{)I.C...
-.
9.1
OLTP
(Online Transaction (Online Analytical
master
read io
9.2
InnoDB Buffer
‘ { , I.CA
9.2 385 - .
2000
1750
1500
æ
H
1250
B
RAID10
1000
750
C
500 - ,
250
ii
Buffer pool ( memory },GB
(Transaction Per
2. row
Variable_name: Innodb_buffer_pool_read_ ahead_ evicted
Value: 0
3. row
Variable_name: In nodb_ buffer_pool_read_requests
Value : 16705131 3
4. row
Variable_name: I nnodb_ buffer_ pool_ reads
Va lue : 129236
5. row * * *************************
Variable_ name: I nnOdb_data_ pend ing_reads
Value: 0
6 . row
Variable data read
Value: 2135642112
7. row
Va ri able name: I nnodb data reads
Va1ue: 130309
*************************** 8. row
Variab1e_name: Innodb_pages_read
Value: 130215
9. row
Variable name: I nnodb rows read
Value: 17651085
9 rows in set (0.00 sec)
Innodb_buffer_p ool_reads
Innodb_buffer_p ool_read_ahead
Innodb_buffer_p ool_read_requests
Innodb data read
Innodb data reads
Innodb_ buffer_pool_read_requests
_
Innodb_data_read
Innodb_data_reads
9.3
9.3.1
9.3.2
.() I. c...
Flash
x16.1 Memory
Controller
C...
Memory I 0.01
SSD3 Il o.05
DDHUAU
oaoa
nana 'ahu
- -
2 3 4
_ io_
Flash
9.4
9 .4 .1
RAID
RAID 0
RAID
RAID RAIDO
RAID 1
RAID I
1.
RAID
Striping Disk 0 Disk I
RAID
,
9 .4 391
RAID RAID5
01 : RAID
RAID
RArD
RAID
RAID
RAID 10 RAID 01
RAIDO RAID 1
RAID
RArDSO
RArDO
RAID
RAID
9 .4 .2 RAID Write
RAID Write
Write
Battery Backup
,,{, I.C.
Througho
Write
my s ql >DELI MIT ER ;
|
Write Back
Write Througb
Write Througb with innodb ftush l og
C...
_flush _Iog_at_trx_
9.4.3
Adapter 10
Versions
================
Product Name : Meq aRAID SAS 8708ELP
Serial No : P012 233608
FW Package Build: 9.0.1-0030
HW Configuration
================
SAS Address 500605bOOOdle180
BBU : Present
Alarm : Present
9 .4
NVRAM Present
•••
Serial Debugger Present
Memory Present
Flash Present
Size 256MB
TPM Ab sent
Phy Po larity : 0
PhyPolari tySplit : 240
Background Rate : 30
Stripe Size : 64kB
Flush Time : 4 seconds
Write Policy : WB
Read Policy : None
Cache Wh en BBU Bad : Diaabled
Cached IO : No
SMART Mode : Mode 6
Alarm Disable : Yes
Coercion Mode : 1GB
SAS Disable No
Auto Oetect BackPlane Enable SGPIO/i2c SEP
Use FOE Only No
Enabl e Led Header
Oelay during POST
SAS
( Write
Adapter '0
9.5
C...
9.6
NTFS ,
9.7
9.7.1 sysbench
Microsoft SQL
General options:
--nurn-threads=N nurnber of threads to use [1]
--max-requests=N limit for total nurnbe r of requests [10000J
--max-time=N lirnit for total execution tirne in seconds [0)
--thread-stack-size=SIZE size of stack per thread [32KJ
C...
Compi1ed- in tests:
fileio - Fi1e 1/0 test
cpu - CPU performance t est
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
- OLTP test
See 'sysbench --test=<name> help' for a list of options for each test.
fileio options:
--file-num=N number of files to create (128)
--fi1e-block-size=N block size to use in a l l 10 operations [16384)
--file-total-size=S1ZE total size of files to create [2G)
- -fi1e- te s t -mode=STR1NG test mode {seqwr , seqrewr , seqrd , rndrd , rndwr ,
rndrw}
- - fi 1e-io-mode- STR1NG . file operations mode Isync , async , fastmmap , s10wmmap}
[sync)
--file-extra-flags=STR1NG additional flags to use on opening files
Isync , dsync , direct} [)
--fi1e-fsync-freq=N do fsync() after this number of requests (0 -
don't use fsync()) [1001
--fi1e - fsync-a11 = [onloff) do fsync() after each write operation [off)
--fi1e-fsync-end=[onloff) do fsync() at the end of test [on)
--fi1e-fsync-mode-STRING which method to use for synchronization I fsync ,
fdatasync} [fsync)
--file- merged-requests=N merge at most this number of 10 requests if
possib1e (0 - don't merge) [0)
--fi1e-rw-ratio=N reads/writes ratio for combined test [1. 5 )
C...
o
seqrd
: 1.
402
•
- rw- ------ 1 r oo t root 128M Aug 12 10:42 t est_fi1e . 0
…-
-rw- - - 1 root
- rw---- --- 1 roo t
r oo t
root
128M Aug 1 2 10:42 t est_fi1e.1
128M Aug 12 10:42 test_fìle.10
-rw- --- - -- 1 root roo t 128M Aug 12 10: 42 test_file.11
- rw------- 1 root root 128M Aug 12 10:42 test_ file.12
- rw------ - 1 root root 128M Aug 12 10:42 test_file.13
-rw---- --- 1 root root 128M Aug 12 10:42 test_fi1e.14
-rw…---- 1 root
-rw------- 1 root
root
root
128M Aug 12 10: 42 test _file .15
1 28M Aug 12 10:42 test_ file.2
-rw--- ---- 1 root root 128M Aug 12 10:42 test fi1 e.3
-rw---- - -- 1 root root 128M Aug 12 10:42 test fi1 e.4
- rw------- 1 root root 128M Aug 1 2 10:42 test_fil e . 5
-rw- - -- - - - 1 root root 128M Aug 12 10:42 test_ fi1e . 6
-rw- ------ 1 roo t root 128M Aug 12 10:42 test fi1e.7
- rw - - - --- - 1 root root 128M Aug 1 2 10:42 test_ file.8
-rw- ------ 1 root r oot 128M Aug 12 10: 42 test_ file. 9
[ root@ x en- server ssd)' sysbench -- test = fileio --file- t otal-size=2G - - file-test-
mode = rndrd --max- time =180 --max-requests =100000000 --num-threads=16
--file-num-1 6 - - file - e xtra-Oags=direct - -fil e-fsync-freq=O - - file - block-size=16384 run
TtD ese
man
--E&O --m
,,‘ me ts
-LS xc er
eq dp
ee -da
ee'• ed qi
.Lnt
X -l'A -m
a e L e e s}
Threads fa i rness:
events (avg/stddev): 38744.2500/10 2.69
execution time (avg/ stddev):
'!/bin/sh
set - u
set -x
set -e
f or size in 8G 64G;
for mode in seqrd seqrw rnd r d rndwr rndrw; do
for blksize in 4096 1638 4 ;
.{)I.CA
--.
sbtest
[ root@xen-server -J'sysbench --test- oltp - -oltp-tab1e-size= 80000000 --db-
driver - mysq1 - -mysq1-socket- /tmp/mysql.sock --mysql-user=root prepare
sysbench 0.4.10: multi-threaded system evaluation benchmark
Threads fairness:
events (avg/stddev): 26979.1250 /64. 14
execution time (avg/stddev): 3599.9123/0.06.
9.7.2 mysql-tpcc
100
..
.) ,..
..
ó"__
ó ol_.. __
jd
..
per
https://code .launchpad.ne t/ ,...__
o
o tpcc_
nra r aI
ms
ee
J
ze
ev
-LT&sr
>}
. nv nu
[DBname): tpcc2
[u ser ): root ••
[pass) :
[warehouse): 100
TPCC Data Load Started...
Loading Item
………………… …………. . . . . . . . . . . . . . . . . 5000
……. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . .. 10000
………………… ……. . . . . . . . . . . . . . . . . . . . . . . 15000
.
...DATA LOADING COMPLETED SUCCESSFULLY.
o
o
[root@xen-server -)1 tpcc_start 127.0.0. 1 tpcc root xxxxxx 100 16 600 1200
<Parameters>
[server): 127.0.0.1
[D8name): tpcc
[user): root
[ pass ): xxxxxx
[wa rehouse ) : 100
[connection]: 16
[rampup) : 600 (se c . )
[measure) : 1200 ( sec . )
1.
MEASURING START .
TPCC
1600
1400 .;
1200
800
-4RAID10
400
200
0
1 31 61 91 121151181211 241271301331361391421451481511541571601631661691
Order Per 10
Order Per 10
t9 ..
-----
.
..
<TpmC>
1949 . 942 TpmC '
9.8
10.1
My5QL 5.1.49
.50"'<< Code
S. ..
M.PM
"'(.' !O
ShEn vo ct u,
H:Uøt5'
rE ut
5.: .'1 9 ..
A
H
,
p A
- ,a - " '-':C5'
•. ..
5.5.5
.8
I u lU lr ) .6 ( Ar ,-h il octur"
PtU:lcASI@
! t'I"W2
. ,t
SuSC 11 S.$. S .:1.1U, ifþl
AP M
: t'lr) :t;,,; s
O f'.,C:'" ;nHx !i
(
,1 " :.....r.:!
) !,
""1.',:;, ð t1:' :.
10.2 411 ,
fsrael .4 I"T"
5.5
InnoDB
innodb
10.2
o dyn:
..{,I. CA
414
j.. 8UILD ,
j archive
cm"klt' t
., csv
CMake Fi les
þ cmd.line. util j,i fedefated
J, cpnfìg .t; heap
ti14:M
j" dbug ibmdb2i
e :>ctr"
J.. myisammfg
i: libmysql J"
1. libmysqld LJ Makefile.in
!; 'e
j; my.ys
j. ..
archive
Jt plugin
k blackhole
x l. csv
}. ..xample
l federated
.1: sql .bench jo heap
þ
j, ibmdb2i
l; innobase
l;i innodb_plugin
J. h my; sam
J.;
U Makefìle.am
é_: mysql_sto,age_engine.cmake
o
o include:
o lock:
o
C...
10.3 415 --'
o
o
o
o
o
10.3 MySQL
10.3.1
Studion
o
o
416
Studio Studio
Studio
2005 , build-vs8
Studio
.....
•
• .... .'
_x
4·i
'''' l
,-
;. ,'1:.... ;:.
:'.".f if---
;.. :.:
.:u l""'.I. ........
-
,.1 . .." . • ,, .‘‘ ..
<1 ., ....t.;..
• Io
'1. a....,)O...-.;....
• ;.,..,
.
.. '" 100...
‘ ...
.. ...... ‘……………
., ,.. …………………..'
• .•… ‘
.
:;00 .... ...,........… .....h ‘
,;
........
-
a
:.',
.;. .
..toJ
. .r .!
j;
••
.……
…If.
""".- . .-..-...-
...•.,...
.. ‘
i.i
...
..
;
I
.'-!
.-.1;C
f
. . ..
"‘ ....Ul
.,....... ..
ou
thread
418
10.3.2
lDE for
5elect _ wlzerd
Create a new C++ prOject
11l( l zarCl s:
...… . . ø . '. '. ....… .....…'" .‘…..…. . .‘
: þ t,è} General
:V ê CIC++
Project
þ .::.' CV5
. .…_.…..…. . .. . ' •
6ft
10.3
i … -. - . • )( ,
C++ ProJect
f
Create C+ + or
t. " ..
1'1
U"'_.' .. __ ". - - -
:J
81 '.‘ ; eg j
u -m
w… .du
· t Z
·n n M
…
hR
…
M
… • ……
mm …? ,
• …
.‘
Fold.r
Creale a new folder resource
… .J
..………-…….._…...,_....…
ll--
o;1
:
11':'
'
;;2
1
:;'
=:J
10.3 InnoDB
"t'.
@
. . .. ...‘'‘….......... :
t
CJC++ ...
Resource
Builders
Þ c /c.. General
:i
Þ Task
Run/O ebug
Hlstory
Selllngs ii… type: 1..
i
..
Ðo. Þ ---
i
.. -. -
; ; i
! 4 . i
11
l
i
il
.. ,
422
-
:, . ".
:
+ Attath 10 :: : i
.... lðUnCh
.
! ;; :: I
!‘
process 'nput : ;
Uslng 5tandard
mðttMd 5 or 5 .tems
.‘-...-‘.., ‘.......
(1)
Y •
.............. ,
,
i: I ": : !
... :
..
:j; i ; :
i Ftner matCn('d or 5 ftems
..., ....._.....1
eJ
10.4
.,; ,,>>.
'."'
j: (' ,... ]')ØOI
i
!f-:;:
þ l' lhI U Cl U 8 J ...:
(1 91
..
" --.-.-. ……~…-…~……_... .. • -
: r
… …
l
i
..‘C'x_t• .l‘,..
,
"
',01..... .1': " ‘ , ,-
!;i …
; 1. u
ii
I
. .ct_op_1I1 t o .. • J 1.
1: :
I 1: i
…'_st.t. ...P-"94‘_I# ,….'ft
:;
I
j U
i:
.. ..H' .) ,‘ ..
õ c_...
.. U ",,_.a‘ tl"Ul_COUftt;
!
;\
"
!.i i" u nwn
J." i -. -----; . '
,--
…. …
…-……-…...
1l1l'I 008: C ".Y
.1"
l 00e 16 16: 03: 28
1'
1.1. 1 '"‘.. ..
1.6: 81: 1] 'v,,"‘ SUI*O;! \e":
10-1 8
10.4
cd mysql-xxx
mi<dir bld
cd b ld
c ma i< e .. -G Xcode
424
'
.. , !IiI A .. . " . 1
M tdl""
_....tA
r.: $ AI ", t - i m; .. ,. I
..
J a .....
a. f
1
;
;
\OOp:
Ð 1 i r.O!! I .. •
• !i ThfUd 5
; JT..
; lT;a l
7: LP f
.n i n
ua
e-
t t
- eu
vbr
1 .t ‘ .t
‘
Auu = lpc
1a&
-
"u. - . t
,$3su
sUwwc
nt
.mus i ‘ A+ a' ‘ • 2a.•.‘ . . ,, r eadu
: r.w:
ga-
‘ f ••
nr M
t --
e
7 w
'
,' mt
V
enz
,
!PHi
;Ð I VA
w ‘ , .;
,
• )! Th,tþd 7 : I
1'h r..d. inui t he IIser ðc t :vi ty counter
s ,- v_activ 1t y_ oUO\ ; , s. tð n o f ttllS
1 1"I'tS:
9
:
• Thtud 10
s.a:& 1f ( srv_10rce_recovery _ f
•
12 9010 suspend_thread;
1 17' a!
T""...14
i
:
::>,: lr /- We r<JfI
)s
t l> r folto.•lln9 \0"0 Ðpp r OX.I9> ð. e ly once per secor,a
Od l Jb. r. e ð CtlV l ty _/
:
•n s rv _ \115 1..\09_ nuSh_1 U o: e(NUL l);
: •
;
=
Mac OS
10.5