アリババMySQL DBA面接問題の答え(議論へようこそ)
アリババの面接問題を何気なく見て、DBMSを振り返ってみましょう.
問題を手に入れて大体1回の難易度をブラウズして大体中上流のレベルで、自分でひざまずいて35%近くの問題に近づきました
自分で次のように答えて、みんなが分析問題を討論することを歓迎します
問題を手に入れて大体1回の難易度をブラウズして大体中上流のレベルで、自分でひざまずいて35%近くの問題に近づきました
自分で次のように答えて、みんなが分析問題を討論することを歓迎します
1、MySQL
.
(1)、 ,3 ;
.
I/O thread
binlog dump
I/O thread
SQL thread
.
(2)、 , ;( )
.
.
mysqldump
innodb binlog
innodb ( binlog)
.
: + or + binlog
.
(3)、 bug 。
, cpu
, auto_instcrment
.
.
2、MySQL myisam innodb , 5
.
(1)、 5 ;
.
.
(2)、 mysql 2 ;
.
(1)
innodb -> xtradb
myisam -> aria
.
(3)、2 。
.
btree InnoDB,MyISAM ,
rtree MyISAM btree 2 ,, rtree 3
.
.
3、 MySQL varchar char varchar(50) 30
.
(1)、varchar char ;
.
0 ,varchar
.
(2)、varchar(50) 50 ;
.
50
.
(3)、int(20) 20 ;( , - -! )
.
int 4 int(11) -21 - +21 11 int(20) ,
.
(4)、 MySQL 。( )
.
[ ] 12 2 MySQL DBA , (2)、(3)
.
.
.
4、 innodb
.
(1)、 ;
.
, , , , ,
.
(2)、 ;
.
table,file
.
(3)、 , 。( !!)
.
.
: -> buffer( ) -> ->
.
,, ,,
.
5、 MySQL binlog
.
(1)、 ;
.
statement ( , )
row cpu
mixed
.
(2)、 ;( ...)
.
.
(3)、 , 。
.
:
: , ,
:
.
6、 MySQL cpu 500% ?
.
(1)、 , ;( ...)
.
(2)、 , 。
.
show processlist ( )
( , cpu i/o ,,,, ,, ,, where ,, )
.
.
7、sql
.
(1)、explain item ;( sql ,, !!!)
.
select ,,
select_type ( or or or )
rows
extra
( )
.
sql : )
where , ,
like
is null, distinct, left/right join, join, union,order by,group by,limit
: select * from table force index(index_name) where
select * from table ignore index(indexname1,indexname2) , ,
.
(2)、profile ;( )
.
(3)、explain 。( ,, + )
sql
( or or ...)
( , ) ,
.
ps: oracle rank,percent_rank
' ' 14W/min
, ,
.
8、 ,mysqldump xtranbackup
.
mysqldump , ,
xtranbackup , , , ,
.
(1)、 ;
.
.. , ,
.
(2)、 ;( )
.
.
(3)、 。
.
, ( ), + +
.
9、500 db,
.
shell , ansible
.
10、 , MySQL DB ?( )
.
.
11、innodb ( ,, )
.
(1)、 ,global buffer pool local buffer;
.
( oracle RAC)
( session )
.
(2)、 ( );
.
(3)、 IO ;
.
innodb_read_io_threads io
innodb_io_capacity io ????
innodb_write_io_threads io
innodb_use_native_aio aio
.
(4)、 。
.
cache ,cache , ,cache ( query_cache)
.
12、 MySQL InnoDB , ?
.
read uncommitted
read committed
REPEATABLE-READ
serialization
.
( :)
snapshot committer
snapshot
.
13、 X( :text ), X , ,
.
(1)、 , ;
.
+ VS
.
,,, ( ) IO, ,,,
.
:
,
.
(2)、 。
.
( ,, ,,, ,, ,,, )
.
14、MySQL InnoDB ( ) ? ?( ,google )
.
( YY , ) (
), !! .. ..
.
google ,, InnoDB
: select * from tab_with_index where id = 1 for update;
for update , id ,
id InnoDB ,,
.
.
.