{"id":81268,"date":"2023-10-20T21:44:05","date_gmt":"2023-10-20T13:44:05","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=81268"},"modified":"2023-10-20T21:44:05","modified_gmt":"2023-10-20T13:44:05","slug":"mysql-high-performance-table","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/mysql-high-performance-table.html","title":{"rendered":"\u5982\u4f55\u8bbe\u8ba1\u51faMySQL\u9ad8\u6027\u80fd\u8868"},"content":{"rendered":"
\u826f\u597d\u7684\u903b\u8f91\u8bbe\u8ba1\u548c\u7269\u7406\u8bbe\u8ba1\u662f\u9ad8\u6027\u80fd\u7684\u57fa\u77f3\uff0c \u5e94\u8be5\u6839\u636e\u7cfb\u7edf\u5c06\u8981\u6267\u884c\u7684\u67e5\u8be2\u8bed\u53e5\u6765\u8bbe\u8ba1schema, \u8fd9\u5f80\u5f80\u9700\u8981\u6743\u8861\u5404\u79cd\u56e0\u7d20\u3002<\/p>\n
<\/p>\n
MySQL\u652f\u6301\u7684\u6570\u636e\u7c7b\u578b\u975e\u5e38\u591a\uff0c \u9009\u62e9\u6b63\u786e\u7684\u6570\u636e\u7c7b\u578b\u5bf9\u4e8e\u83b7\u5f97\u9ad8\u6027\u80fd\u81f3\u5173\u91cd\u8981\u3002<\/p>\n
\u66f4\u5c0f\u7684\u901a\u5e38\u66f4\u597d<\/strong><\/p>\n \u66f4\u5c0f\u7684\u6570\u636e\u7c7b\u578b\u901a\u5e38\u66f4\u5feb\uff0c \u56e0\u4e3a\u5b83\u4eec\u5360\u7528\u66f4\u5c11\u7684\u78c1\u76d8\u3001 \u5185\u5b58\u548cCPU\u7f13\u5b58\uff0c \u5e76\u4e14\u5904\u7406\u65f6\u9700\u8981\u7684CPU\u5468\u671f\u4e5f\u66f4\u5c11\u3002<\/p>\n \u7b80\u5355\u5c31\u597d<\/strong><\/p>\n \u7b80\u5355\u6570\u636e\u7c7b\u578b\u7684\u64cd\u4f5c\u901a\u5e38\u9700\u8981\u66f4\u5c11\u7684CPU\u5468\u671f\u3002 \u4f8b\u5982\uff0c \u6574\u578b\u6bd4\u5b57\u7b26\u64cd\u4f5c\u4ee3\u4ef7\u66f4\u4f4e\uff0c \u56e0\u4e3a\u5b57\u7b26\u96c6\u548c\u6821\u5bf9\u89c4\u5219\uff08\u6392\u5e8f\u89c4\u5219 \uff09\u4f7f\u5b57\u7b26\u6bd4\u8f83\u6bd4\u6574\u578b\u6bd4\u8f83\u66f4\u590d\u6742\u3002<\/p>\n \u5c3d\u91cf\u907f\u514dNULL<\/strong><\/p>\n \u5982\u679c\u67e5\u8be2\u4e2d\u5305\u542b\u53ef\u4e3aNULL \u7684\u5217\uff0c \u5bf9MySQL\u6765\u8bf4\u66f4\u96be\u4f18\u5316\uff0c \u56e0\u4e3a\u53ef\u4e3aNULL \u7684\u5217\u4f7f\u5f97\u7d22\u5f15\u3001 \u7d22\u5f15\u7edf\u8ba1\u548c\u503c\u6bd4\u8f83\u90fd\u66f4\u590d\u6742\u3002 \u53ef\u4e3aNULL\u7684\u5217\u4f1a\u4f7f\u7528\u66f4\u591a\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c \u5728MySQL\u91cc\u4e5f\u9700\u8981\u7279\u6b8a\u5904\u7406\u3002 \u5f53\u53ef\u4e3aNULL\u7684\u5217\u88ab\u7d22\u5f15\u65f6\uff0c \u6bcf\u4e2a\u7d22\u5f15\u8bb0\u5f55\u9700\u8981\u4e00\u4e2a\u989d\u5916\u7684\u5b57\u8282\uff0c \u5728MyISAM\u91cc\u751a\u81f3\u8fd8\u53ef\u80fd\u5bfc\u81f4\u56fa\u5b9a\u5927\u5c0f\u7684\u7d22\u5f15\uff08\u4f8b\u5982\u53ea\u6709\u4e00\u4e2a\u6574\u6570\u5217\u7684\u7d22\u5f15\uff09\u53d8\u6210\u53ef\u53d8\u5927\u5c0f\u7684\u7d22\u5f15\u3002<\/p>\n \u5f53\u7136\u4e5f\u6709\u4f8b\u5916\uff0c \u4f8b\u5982InnoDB \u4f7f\u7528\u5355\u72ec\u7684\u4f4d (bit) \u5b58\u50a8NULL\u503c\uff0c \u6240\u4ee5\u5bf9\u4e8e\u7a00\u758f\u6570\u636e\u6709\u5f88\u597d\u7684\u7a7a\u95f4\u6548\u7387\u3002<\/p>\n 1.\u6574\u6570\u7c7b\u578b<\/strong><\/p>\n \u6709\u4e24\u79cd\u7c7b\u578b\u7684\u6570\u5b57\uff1a\u6574\u6570 (whole number) \u548c\u5b9e\u6570 (real number) \u3002 \u5982\u679c\u5b58\u50a8\u6574\u6570\uff0c \u53ef\u4ee5\u4f7f\u7528\u8fd9\u51e0\u79cd\u6574\u6570\u7c7b\u578b\uff1aTINYINT, SMALLINT, MEDIUMINT, INT, BIGINT\u3002\u5206\u522b\u4f7f\u75288,16, 24, 32, 64\u4f4d\u5b58\u50a8\u7a7a\u95f4\u3002<\/p>\n \u6574\u6570\u7c7b\u578b\u6709\u53ef\u9009\u7684 **UNSIGNED ** \u5c5e\u6027\uff0c\u8868\u793a\u4e0d\u5141\u8bb8\u8d1f\u503c\uff0c\u8fd9\u5927\u81f4\u53ef\u4ee5\u4f7f\u6b63\u6570\u7684\u4e0a\u9650\u63d0\u9ad8\u4e00\u500d\u3002 \u4f8b\u5982 TINYINT. UNSIGNED \u53ef\u4ee5\u5b58\u50a8\u7684\u8303\u56f4\u662f 0 - 255, \u800c TINYINT \u7684\u5b58\u50a8\u8303\u56f4\u662f -128 -127 \u3002<\/p>\n \u6709\u7b26\u53f7\u548c\u65e0\u7b26\u53f7\u7c7b\u578b\u4f7f\u7528\u76f8\u540c\u7684\u5b58\u50a8\u7a7a\u95f4\uff0c\u5e76\u5177\u6709\u76f8\u540c\u7684\u6027\u80fd \uff0c \u56e0\u6b64\u53ef\u4ee5\u6839\u636e\u5b9e\u9645\u60c5\u51b5\u9009\u62e9\u5408\u9002\u7684\u7c7b\u578b\u3002<\/p>\n \u4f60\u7684\u9009\u62e9\u51b3\u5b9a MySQL \u662f\u600e\u4e48\u5728\u5185\u5b58\u548c\u78c1\u76d8\u4e2d\u4fdd\u5b58\u6570\u636e\u7684\u3002 \u7136\u800c\uff0c \u6574\u6570\u8ba1\u7b97\u4e00\u822c\u4f7f\u752864 \u4f4d\u7684 BIGINT \u6574\u6570\uff0c \u5373\u4f7f\u5728 32 \u4f4d\u73af\u5883\u4e5f\u662f\u5982\u6b64\u3002\uff08 \u4e00\u4e9b\u805a\u5408\u51fd\u6570\u662f\u4f8b\u5916\uff0c \u5b83\u4eec\u4f7f\u7528DECIMAL \u6216 DOUBLE \u8fdb\u884c\u8ba1\u7b97\uff09\u3002<\/p>\n MySQL \u53ef\u4ee5\u4e3a\u6574\u6570\u7c7b\u578b\u6307\u5b9a\u5bbd\u5ea6\uff0c \u4f8b\u5982 INT(11), \u5bf9\u5927\u591a\u6570\u5e94\u7528\u8fd9\u662f\u6ca1\u6709\u610f\u4e49\u7684\uff1a\u5b83\u4e0d\u4f1a\u9650\u5236\u503c\u7684\u5408\u6cd5\u8303\u56f4\uff0c\u53ea\u662f\u89c4\u5b9a\u4e86MySQL \u7684\u4e00\u4e9b\u4ea4\u4e92\u5de5\u5177\uff08\u4f8b\u5982 MySQL \u547d\u4ee4\u884c\u5ba2\u6237\u7aef\uff09\u7528\u6765\u663e\u793a\u5b57\u7b26\u7684\u4e2a\u6570\u3002 \u5bf9\u4e8e\u5b58\u50a8\u548c\u8ba1\u7b97\u6765\u8bf4\uff0c INT(1) \u548c INT(20) \u662f\u76f8\u540c\u7684\u3002<\/p>\n 2.\u5b9e\u6570\u7c7b\u578b<\/strong><\/p>\n \u5b9e\u6570\u662f\u5e26\u6709\u5c0f\u6570\u90e8\u5206\u7684\u6570\u5b57\u3002 \u7136\u800c\uff0c \u5b83\u4eec\u4e0d\u53ea\u662f\u4e3a\u4e86\u5b58\u50a8\u5c0f\u6570\u90e8\u5206\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528DECIMAL \u5b58\u50a8\u6bd4 BIGINT \u8fd8\u5927\u7684\u6574\u6570\u3002<\/p>\n FLOAT\u548cDOUBLE\u7c7b\u578b\u652f\u6301\u4f7f\u7528\u6807\u51c6\u7684\u6d6e\u70b9\u8fd0\u7b97\u8fdb\u884c\u8fd1\u4f3c\u8ba1\u7b97\u3002<\/p>\n DECIMAL\u7c7b\u578b\u7528\u4e8e\u5b58\u50a8\u7cbe\u786e\u7684\u5c0f\u6570\u3002<\/p>\n \u6d6e\u70b9\u548cDECIMAL\u7c7b\u578b\u90fd\u53ef\u4ee5\u6307\u5b9a\u7cbe\u5ea6\u3002 \u5bf9\u4e8eDECIMAL\u5217\uff0c \u53ef\u4ee5\u6307\u5b9a\u5c0f\u6570\u70b9\u524d\u540e\u6240\u5141\u8bb8\u7684\u6700\u5927\u4f4d\u6570\u3002\u8fd9\u4f1a\u5f71\u54cd\u5217\u7684\u7a7a\u95f4\u6d88\u8017\u3002<\/p>\n \u6709\u591a\u79cd\u65b9\u6cd5\u53ef\u4ee5\u6307\u5b9a\u6d6e\u70b9\u5217\u6240\u9700\u8981\u7684\u7cbe\u5ea6\uff0c \u8fd9\u4f1a\u4f7f\u5f97MySQL\u9009\u62e9\u4e0d\u540c\u7684\u6570\u636e\u7c7b\u578b\uff0c\u6216\u8005\u5728\u5b58\u50a8\u65f6\u5bf9\u503c\u8fdb\u884c\u53d6\u820d\u3002 \u8fd9\u4e9b\u7cbe\u5ea6\u5b9a\u4e49\u662f\u975e\u6807\u51c6\u7684\uff0c\u6240\u4ee5\u6211\u4eec\u5efa\u8bae\u53ea\u6307\u5b9a\u6570\u636e\u7c7b\u578b\uff0c\u4e0d\u6307\u5b9a\u7cbe\u5ea6\u3002<\/p>\n \u6d6e\u70b9\u7c7b\u578b\u5728\u5b58\u50a8\u540c\u6837\u8303\u56f4\u7684\u503c\u65f6\uff0c \u901a\u5e38\u6bd4DECIMAL\u4f7f\u7528\u66f4\u5c11\u7684\u7a7a\u95f4\u3002FLOAT\u4f7f\u75284\u4e2a\u5b57\u8282\u5b58\u50a8\u3002DOUBLE\u5360\u75288\u4e2a\u5b57\u8282\uff0c\u76f8\u6bd4FLOAT\u6709\u66f4\u9ad8\u7684\u7cbe\u5ea6\u548c\u66f4\u5927\u7684\u8303\u56f4\u3002\u548c\u6574\u6570\u7c7b\u578b\u4e00\u6837\uff0c \u80fd\u9009\u62e9\u7684\u53ea\u662f\u5b58\u50a8\u7c7b\u578b\uff1b MySQL\u4f7f\u7528DOUBLE\u4f5c\u4e3a\u5185\u90e8\u6d6e\u70b9\u8ba1\u7b97\u7684\u7c7b\u578b\u3002<\/p>\n \u56e0\u4e3a\u9700\u8981\u989d\u5916\u7684\u7a7a\u95f4\u548c\u8ba1\u7b97\u5f00\u9500\uff0c\u6240\u4ee5\u5e94\u8be5\u5c3d\u91cf\u53ea\u5728\u5bf9\u5c0f\u6570\u8fdb\u884c\u7cbe\u786e\u8ba1\u7b97\u65f6\u624d\u4f7f\u7528DECIMAL\u3002\u4f46\u5728\u6570\u636e\u6700\u6bd4\u8f83\u5927\u7684\u65f6\u5019\uff0c \u53ef\u4ee5\u8003\u8651\u4f7f\u7528BIGINT\u4ee3\u66ffDECIMAL, \u5c06\u9700\u8981\u5b58\u50a8\u7684\u8d27\u5e01\u5355\u4f4d\u6839\u636e\u5c0f\u6570\u7684\u4f4d\u6570\u4e58\u4ee5\u76f8\u5e94\u7684\u500d\u6570\u5373\u53ef\u3002<\/p>\n 3.\u5b57\u7b26\u4e32\u7c7b\u578b<\/strong><\/p>\n VARCHAR<\/strong><\/p>\n CHAR<\/strong><\/p>\n \u6177\u6168\u662f\u4e0d\u660e\u667a\u7684<\/strong><\/p>\n \u4f7f\u7528VARCHAR(5)\u548cVARCHAR(200)\u5b58\u50a8'hello'\u7684\u7a7a\u95f4\u5f00\u9500\u662f\u4e00\u6837\u7684\u3002 \u90a3\u4e48\u4f7f\u7528\u66f4\u77ed\u7684\u5217\u6709\u4ec0\u4e48\u4f18\u52bf\u5417\uff1f<\/p>\n \u4e8b\u5b9e\u8bc1\u660e\u6709\u5f88\u5927\u7684\u4f18\u52bf\u3002 \u66f4\u957f\u7684\u5217\u4f1a\u6d88\u8017\u66f4\u591a\u7684\u5185\u5b58\uff0c \u56e0\u4e3aMySQL\u901a\u5e38\u4f1a\u5206\u914d\u56fa\u5b9a\u5927\u5c0f\u7684\u5185\u5b58\u5757\u6765\u4fdd\u5b58\u5185\u90e8\u503c\u3002 \u5c24\u5176\u662f\u4f7f\u7528\u5185\u5b58\u4e34\u65f6\u8868\u8fdb\u884c\u6392\u5e8f\u6216\u64cd\u4f5c\u65f6\u4f1a\u7279\u522b\u7cdf\u7cd5\u3002 \u5728\u5229\u7528\u78c1\u76d8\u4e34\u65f6\u8868\u8fdb\u884c\u6392\u5e8f\u65f6\u4e5f\u540c\u6837\u7cdf\u7cd5\u3002<\/p>\n \u6240\u4ee5\u6700\u597d\u7684\u7b56\u7565\u662f\u53ea\u5206\u914d\u771f\u6b63\u9700\u8981\u7684\u7a7a\u95f4\u3002<\/p>\n 4.BLOB\u548cTEXT\u7c7b\u578b<\/strong><\/p>\n BLOB\u548c TEXT\u90fd\u662f\u4e3a\u5b58\u50a8\u5f88\u5927\u7684\u6570\u636e\u800c\u8bbe\u8ba1\u7684\u5b57\u7b26\u4e32\u6570\u636e\u7c7b\u578b\uff0c \u5206\u522b\u91c7\u7528 \u4e8c\u8fdb\u5236\u548c\u5b57\u7b26\u65b9\u5f0f\u5b58\u50a8 \u3002<\/p>\n \u4e0e\u5176\u4ed6\u7c7b\u578b\u4e0d\u540c\uff0c MySQL\u628a\u6bcf\u4e2aBLOB\u548cTEXT\u503c\u5f53\u4f5c\u4e00\u4e2a\u72ec\u7acb\u7684\u5bf9\u8c61\u5904\u7406\u3002 \u5b58\u50a8\u5f15\u64ce\u5728\u5b58\u50a8\u65f6\u901a\u5e38\u4f1a\u505a\u7279\u6b8a\u5904\u7406\u3002 \u5f53BLOB\u548cTEXT\u503c\u592a\u5927\u65f6\uff0cInnoDB\u4f1a\u4f7f\u7528\u4e13\u95e8\u7684 \u201c\u5916\u90e8\u201c\u5b58\u50a8\u533a\u57df\u6765\u8fdb\u884c\u5b58\u50a8\uff0c \u6b64\u65f6\u6bcf\u4e2a\u503c\u5728\u884c\u5185\u9700\u89811 - 4\u4e2a\u5b57\u8282\u5b58\u50a8 \u5b58\u50a8\u533a\u57df\u5b58\u50a8\u5b9e\u9645\u7684\u503c\u3002<\/p>\n BLOB \u548c TEXT \u4e4b\u95f4\u4ec5\u6709\u7684\u4e0d\u540c\u662f BLOB \u7c7b\u578b\u5b58\u50a8\u7684\u662f\u4e8c\u8fdb\u5236\u6570\u636e\uff0c \u6ca1\u6709\u6392\u5e8f\u89c4\u5219\u6216\u5b57\u7b26\u96c6\uff0c \u800c TEXT\u7c7b\u578b\u6709\u5b57\u7b26\u96c6\u548c\u6392\u5e8f\u89c4\u5219<\/p>\n 5.\u65e5\u671f\u548c\u65f6\u95f4\u7c7b\u578b<\/strong><\/p>\n \u5927\u90e8\u5206\u65f6\u95f4\u7c7b\u578b\u90fd\u6ca1\u6709\u66ff\u4ee3\u54c1\uff0c \u56e0\u6b64\u6ca1\u6709\u4ec0\u4e48\u662f\u6700\u4f73\u9009\u62e9\u7684\u95ee\u9898\u3002 \u552f\u4e00\u7684\u95ee\u9898\u662f\u4fdd\u5b58\u65e5\u671f\u548c\u65f6\u95f4\u7684\u65f6\u5019\u9700\u8981\u505a\u4ec0\u4e48\u3002 MySQL\u63d0\u4f9b\u4e24\u79cd\u76f8\u4f3c\u7684\u65e5\u671f\u7c7b\u578b\uff1a DATE TIME\u548c TIMESTAMP\u3002<\/p>\n \u4f46\u662f\u76ee\u524d\u6211\u4eec\u66f4\u5efa\u8bae\u5b58\u50a8\u65f6\u95f4\u6233\u7684\u65b9\u5f0f\uff0c\u56e0\u6b64\u8be5\u5904\u4e0d\u518d\u5bf9 DATE TIME\u548c TIMESTAMP\u505a\u8fc7\u591a\u8bf4\u660e\u3002<\/p>\n 6.\u5176\u4ed6\u7c7b\u578b<\/strong><\/p>\n 6.1\u9009\u62e9\u6807\u8bc6\u7b26<\/strong><\/p>\n \u5728\u53ef\u4ee5\u6ee1\u8db3\u503c\u7684\u8303\u56f4\u7684\u9700\u6c42\uff0c \u4e95\u4e14\u9884\u7559\u672a\u6765\u589e\u957f\u7a7a\u95f4\u7684\u524d\u63d0\u4e0b\uff0c \u5e94\u8be5\u9009\u62e9\u6700\u5c0f\u7684\u6570\u636e\u7c7b\u578b\u3002<\/p>\n \u6574\u6570\u901a\u5e38\u662f\u6807\u8bc6\u5217\u6700\u597d\u7684\u9009\u62e9\uff0c \u56e0\u4e3a\u5b83\u4eec\u5f88\u5feb\u5e76\u4e14\u53ef\u4ee5\u4f7f\u7528AUTO_INCREMENT\u3002<\/p>\n \u5bf9\u4e8e\u6807\u8bc6\u5217\u6765\u8bf4\uff0cEMUM\u548cSET\u7c7b\u578b\u901a\u5e38\u662f\u4e00\u4e2a\u7cdf\u7cd5\u7684\u9009\u62e9\uff0c \u5c3d\u7ba1\u5bf9\u67d0\u4e9b\u53ea\u5305\u542b\u56fa\u5b9a\u72b6\u6001\u6216\u8005\u7c7b\u578b\u7684\u9759\u6001 \u201d\u5b9a\u4e49\u8868\u201d \u6765\u8bf4\u53ef\u80fd\u662f\u6ca1\u6709\u95ee\u9898\u7684\u3002ENUM\u548cSET\u5217\u9002\u5408\u5b58\u50a8\u56fa\u5b9a\u4fe1\u606f\uff0c \u4f8b\u5982\u6709\u5e8f\u7684\u72b6\u6001\u3001 \u4ea7\u54c1\u7c7b\u578b\u3001 \u4eba\u7684\u6027\u522b\u3002<\/p>\n \u5982\u679c\u53ef\u80fd\uff0c \u5e94\u8be5\u907f\u514d\u4f7f\u7528\u5b57\u7b26\u4e32\u7c7b\u578b\u4f5c\u4e3a\u6807\u8bc6\u5217\uff0c \u56e0\u4e3a\u5b83\u4eec\u5f88\u6d88\u8017\u7a7a\u95f4\uff0c \u5e76\u4e14\u901a\u5e38\u6bd4\u6570\u5b57\u7c7b\u578b\u6162\u3002<\/p>\n \u5bf9\u4e8e\u5b8c\u5168 \u201c\u968f\u673a\u201d \u7684\u5b57\u7b26\u4e32\u4e5f\u9700\u8981\u591a\u52a0\u6ce8\u610f\uff0c \u4f8b\u5982 MDS() \u3001 SHAl() \u6216\u8005 UUID() \u4ea7\u751f\u7684\u5b57\u7b26\u4e32\u3002 \u8fd9\u4e9b\u51fd\u6570\u751f\u6210\u7684\u65b0\u503c\u4f1a\u4efb\u610f\u5206\u5e03\u5728\u5f88\u5927\u7684\u7a7a\u95f4\u5185\uff0c \u8fd9\u4f1a\u5bfc\u81f4 INSERT \u4ee5\u53ca\u4e00\u4e9bSELECT\u8bed\u53e5\u53d8\u5f97\u5f88\u6162\u3002\u5982\u679c\u5b58\u50a8 UUID \u503c\uff0c \u5219\u5e94\u8be5\u79fb\u9664 \"-\"\u7b26\u53f7\u3002<\/p>\n 6.2\u7279\u6b8a\u7c7b\u578b\u6570\u636e<\/strong><\/p>\n \u67d0\u4e9b\u7c7b\u578b\u7684\u6570\u636e\u4e95\u4e0d\u76f4\u63a5\u4e0e\u5185\u7f6e\u7c7b\u578b\u4e00\u81f4\u3002 \u4f4e\u5343\u79d2\u7ea7\u7cbe\u5ea6\u7684\u65f6\u95f4\u6233\u5c31\u662f\u4e00\u4e2a\u4f8b\u5b50\uff0c\u53e6\u4e00\u4e2a\u4f8b\u5b50\u662f\u4ee5\u4e2a1Pv4\u5730\u5740\uff0c\u4eba\u4eec\u7ecf\u5e38\u4f7f\u7528VARCHAR(15)\u5217\u6765\u5b58\u50a8IP\u5730\u5740\uff0c\u7136\u800c\uff0c \u5b83\u4eec\u5b9e\u9645\u4e0a\u662f32\u4f4d\u65e0\u7b26\u53f7\u6574\u6570\uff0c \u4e0d\u662f\u5b57\u7b26\u4e32\u3002\u7528\u5c0f\u6570\u70b9\u5c06\u5730\u5740\u5206\u6210\u56db\u6bb5\u7684\u8868\u793a\u65b9\u6cd5\u53ea\u662f\u4e3a\u4e86\u8ba9\u4eba\u4eec\u9605\u8bfb\u5bb9\u6613\u3002\u6240\u4ee5\u5e94\u8be5\u7528\u65e0\u7b26\u53f7\u6574\u6570\u5b58\u50a8IP\u5730\u5740\u3002MySQL\u63d0\u4f9bINET_ATON()\u548cINET_NTOA()\u51fd\u6570\u5728\u8fd9\u4e24\u79cd\u8868\u793a\u65b9\u6cd5\u4e4b\u95f4\u8f6c\u6362\u3002<\/p>\n 1.\u8303\u5f0f\u548c\u53cd\u8303\u5f0f<\/strong><\/p>\n \u5bf9\u4e8e\u4efb\u4f55\u7ed9\u5b9a\u7684\u6570\u636e\u901a\u5e38\u90fd\u6709\u5f88\u591a\u79cd\u8868\u793a\u65b9\u6cd5\uff0c \u4ece\u5b8c\u5168\u7684\u8303\u5f0f\u5316\u5230\u5b8c\u5168\u7684\u53cd\u8303\u5f0f\u5316\uff0c \u4ee5\u53ca\u4e24\u8005\u7684\u6298\u4e2d\u3002 \u5728\u8303\u5f0f\u5316\u7684\u6570\u636e\u5e93\u4e2d\uff0c \u6bcf\u4e2a\u4e8b\u5b9e\u6570\u636e\u4f1a\u51fa\u73b0\u5e76\u4e14\u53ea\u51fa\u73b0\u4e00\u6b21\u3002 \u76f8\u53cd\uff0c \u5728\u53cd\u8303\u5f0f\u5316\u7684\u6570\u636e\u5e93\u4e2d\uff0c \u4fe1\u606f\u662f\u5197\u4f59\u7684\uff0c \u53ef\u80fd\u4f1a\u5b58\u50a8\u5728\u591a\u4e2a\u5730\u65b9\u3002<\/p>\n \u8303\u5f0f\u7684\u4f18\u70b9\u548c\u7f3a\u70b9<\/strong><\/p>\n \u4e3a\u6027\u80fd\u63d0\u5347\u8003\u8651\u65f6\uff0c\u7ecf\u5e38\u4f1a\u88ab\u5efa\u8bae\u5bf9 schema \u8fdb\u884c\u8303\u5f0f\u5316\u8bbe\u8ba1\uff0c\u5c24\u5176\u662f\u5199\u5bc6\u96c6\u7684\u573a\u666f\u3002<\/p>\n \u53cd\u8303\u5f0f\u7684\u4f18\u70b9\u548c\u7f3a\u70b9<\/strong><\/p>\n \u4e0d\u9700\u8981\u5173\u8054\u8868\uff0c\u5219\u5bf9\u5927\u90e8\u5206\u67e5\u8be2\u6700\u5dee\u7684\u60c5\u51b5\u2014\u2014\u5373\u4f7f\u8868\u6ca1\u6709\u4f7f\u7528\u7d22\u5f15\u2014\u2014\u662f\u5168\u8868\u626b\u63cf\u3002 \u5f53\u6570\u636e\u6bd4\u5185\u5b58\u5927\u65f6\u8fd9\u53ef\u80fd\u6bd4\u5173\u8054\u8981\u5feb\u5f97\u591a\uff0c\u56e0\u4e3a\u8fd9\u6837\u907f\u514d\u4e86\u968f\u673aI\/0\u3002<\/p>\n \u5355\u72ec\u7684\u8868\u4e5f\u80fd\u4f7f\u7528\u66f4\u6709\u6548\u7684\u7d22\u5f15\u7b56\u7565\u3002<\/p>\n \u6df7\u7528\u8303\u5f0f\u5316\u548c\u53cd\u8303\u5f0f\u5316<\/strong><\/p>\n \u5728\u5b9e\u9645\u5e94\u7528\u4e2d\u7ecf\u5e38\u9700\u8981\u6df7\u7528\uff0c\u53ef\u80fd\u4f7f\u7528\u90e8\u5206\u8303\u5f0f\u5316\u7684 schema \u3001 \u7f13\u5b58\u8868\uff0c\u4ee5\u53ca\u5176\u4ed6\u6280\u5de7\u3002<\/p>\n \u8868\u9002\u5f53\u589e\u52a0\u5197\u4f59\u5b57\u6bb5\uff0c\u5982\u6027\u80fd\u4f18\u5148\uff0c\u4f46\u4f1a\u589e\u52a0\u590d\u6742\u5ea6\u3002\u53ef\u907f\u514d\u8868\u5173\u8054\u67e5\u8be2\u3002<\/p>\n \u7b80\u5355\u719f\u6089\u6570\u636e\u5e93\u8303\u5f0f<\/strong><\/p>\n \u7b2c\u4e8c\u8303\u5f0f(2NF)\uff1a\u4e00\u4e2a\u8868\u5fc5\u987b\u6709\u4e3b\u952e,\u5373\u6bcf\u884c\u6570\u636e\u90fd\u80fd\u88ab\u552f\u4e00\u7684\u533a\u5206; \u7b2c\u4e09\u8303\u5f0f(3NF)\uff1a\u4e00\u4e2a\u8868\u4e2d\u4e0d\u80fd\u5305\u6db5\u5176\u4ed6\u76f8\u5173\u8868\u4e2d\u975e\u5173\u952e\u5b57\u6bb5\u7684\u4fe1\u606f,\u5373\u6570\u636e\u8868\u4e0d\u80fd\u6709\u6c89\u4f59\u5b57\u6bb5; 2.\u8868\u5b57\u6bb5\u5c11\u7cbe<\/strong><\/p>\n \u539f\u6587\u6765\u81ea\uff1ahttp:\/\/www.jianshu.com\/p\/f797bbe11d76<\/a><\/p>\n\n
\n
\n
\n
\n
\n
\n\u7b2c\u4e00\u8303\u5f0f(1NF)\uff1a\u5b57\u6bb5\u503c\u5177\u6709\u539f\u5b50\u6027,\u4e0d\u80fd\u518d\u5206(\u6240\u6709\u5173\u7cfb\u578b\u6570\u636e\u5e93\u7cfb\u7edf\u90fd\u6ee1\u8db3\u7b2c\u4e00\u8303\u5f0f);
\n\u4f8b\u5982\uff1a\u59d3\u540d\u5b57\u6bb5,\u5176\u4e2d\u59d3\u548c\u540d\u662f\u4e00\u4e2a\u6574\u4f53,\u5982\u679c\u533a\u5206\u59d3\u548c\u540d\u90a3\u4e48\u5fc5\u987b\u8bbe\u7acb\u4e24\u4e2a\u72ec\u7acb\u5b57\u6bb5;<\/code><\/p>\n
\n\u5907\u6ce8\uff1a\u5fc5\u987b\u5148\u6ee1\u8db3\u7b2c\u4e00\u8303\u5f0f;<\/p>\n
\n\u5907\u6ce8\uff1a\u5fc5\u987b\u5148\u6ee1\u8db3\u7b2c\u4e8c\u8303\u5f0f;<\/p>\n\n
\n