Mariadb 資料庫進階學習一 表的重新認識
阿新 • • 發佈:2020-12-14
通過簡單的Sql語句建立表後,表是怎麼儲存的,以什麼的方式進行儲存的,佔的磁碟空間是怎麼算的?就是想通過深入學習,瞭解其內部構造結構。
MariaDB [db_test]> create table t8 (id int,sex char(1),username varchar(100),age tinyint,brithday date); Query OK, 0 rows affected (0.028 sec)
在磁碟中找到對應的資料表文件:
[root@172 /]# cd /var/lib/mysql/db_test [root@172 db_test]# ls db.opt t2.frm t2.ibd t3.frm t3.ibd t5.frm t5.ibd t6.frm t6.ibd t7.frm t7.ibd t8.frm t8.ibd
兩份檔案對應的大小分別是:t8.frm 633B,t8.ibd 96KB (98.304B)
[root@172 db_test]# hexdump -C t8.frm 00000000 fe 01 0a 0c 12 00 56 00 01 00 44 03 00 00 10 00 |......V...D.....| 00000010 3a 01 00 00 00 00 00 00 00 00 00 02 08 00 09 00 |:...............| 00000020 00 05 00 00 00 00 21 00 00 00 00 00 00 00 00 10 |......!.........| 00000030 00 00 00 3c 88 01 00 10 00 00 00 00 00 00 00 00 |...<............| 00000040 00 10 ad b8 52 30 3d b5 11eb ac 4b 0c da 41 1d |....R0=....K..A.| 00000050 8a 5a b0 01 00 00 00 00 00 00 02 00 ff 00 00 00 |.Z..............| 00000060 00 00 00 00 00 00 ff 00 00 00 00 20 20 20 00 00 |........... ..| 00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| * 000001a0 00 00 06 00 49 6e 6e 6f 44 42 00 00 00 00 00 00 |....InnoDB......| // 表儲存的儲存引擎 000001b0 94 01 94 01 00 00 00 00 00 00 00 00 00 00 00 00 |................| 000001c0 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 |................| * 000002b0 00 00 05 00 00 00 48 01 00 00 3a 01 1f 00 00 00 |......H...:.....| 000002c0 00 00 00 00 00 00 50 00 16 00 05 00 00 00 00 00 |......P.........| 000002d0 00 00 00 0b 00 02 00 00 1b 80 00 00 00 03 21 00 |..............!.| 000002e0 00 00 00 00 03 00 06 00 00 00 80 00 00 00 fe 21 |...............!| 000002f0 00 00 00 00 00 2c 01 09 00 00 00 80 00 00 00 0f |.....,..........| 00000300 21 00 00 00 00 00 04 00 37 01 00 0b 80 00 00 00 |!.......7.......| 00000310 01 21 00 00 00 00 00 0a 00 38 01 00 70 80 00 00 |.!.......8..p...| 00000320 00 0e 21 00 00 ff 69 64 ff 73 65 78 ff 75 73 65 |..!...id.sex.use| // 表的欄位 00000330 72 6e 61 6d 65 ff 61 67 65 ff 62 72 69 74 68 64 |rname.age.brithd| 00000340 61 79 ff 00 |ay..| 00000344
竟然沒有找到對應的欄位屬性及長度值,這塊到底怎麼看啊。。。看來還得有高人指點才行啊。