MySQL鍒嗗尯绫诲瀷
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL鍒嗗尯绫诲瀷相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/ati' title='ati'>ati
null ast 榛樿 鎯呭喌 hash datetime鍗氭枃澶х翰锛?/p>
- 1銆丷ANGE鍒嗗尯
- 2銆丩IST鍒嗗尯
- 3銆丠ASH鍒嗗尯
- 4銆乲ey鍒嗗尯
- 5銆丮ySQL鍒嗚〃鍜屽垎鍖虹殑鍖哄埆
- 6銆侀檮鍔狅細濡備綍瀹炵幇灏嗗垎鍖烘斁鍦ㄤ笉鍚岀殑鐩綍涓嬭繘琛屽瓨鍌?/li>
MySQL鍒嗗尯绫诲瀷濡備笅锛?/p>
- RANFGE鍒嗗尯
- LIST鍒嗗尯
- HASH鍒嗗尯
- key鍒嗗尯
涓婇潰鐨勫洓绉嶅垎鍖虹殑鏉′欢蹇呴』鏄暣褰紝濡傛灉涓嶆槸鏁村舰闇€瑕侀€氳繃鍑芥暟灏嗗叾杞崲涓烘暣褰€?/strong>
1銆丷ANGE鍒嗗尯
RANGE鍒嗗尯鏄熀浜庡睘浜庝竴涓粰瀹氳繛缁尯闂寸殑鍒楀€硷紝鎶婂琛屽垎閰嶇粰鍒嗗尯銆傝繖浜涘尯闂磋杩炵画涓斾笉鑳界浉浜掗噸鍙狅紝浣跨敤values less than鎿嶄綔绗︽潵杩涜瀹氫箟銆?/p>
鍒涘缓涓€涓猂ANGE鍒嗗尯鏂瑰紡鐨勮〃锛?/p>
mysql> create table employees (
-> id int not null,
-> fname varchar(30),
-> lname varchar(30),
-> hired date not null default 鈥?970-01-01鈥?
-> separated date not null default 鈥?999-12-31鈥?
-> job_code int not null,
-> store_id int not null
-> )
-> partition by range (store_id) (
-> partition p0 values less than (6),
-> partition p1 values less than (11),
-> partition p2 values less than (16),
-> partition p3 values less than (21)
-> );
鎸夌収杩欑鍒嗗尯鏂规锛屽綋鎻掑叆鐨勮褰晄tore_id灏忎簬6锛屼細淇濆瓨鍦╬0杩欎釜鍒嗗尯锛屽鏋渟tore_id灏忎簬11鍒欎細灏嗘暟鎹繚瀛樺湪p1杩欎釜鍒嗗尯.....浠ユ绫绘帹銆備絾鏄湪涓婇潰鐨勫垎鍖烘柟妗堜腑锛屽畾涔夌殑鏈€鍚庝竴涓垎鍖烘槸灏忎簬21鐨勶紝閭d箞锛屽鏋滄鏃舵湁store_id澶т簬鎴栫瓑浜?1鐨勮褰曪紝鍒欎細鎻掑叆澶辫触锛屽洜涓烘暟鎹簱涓嶇煡閬撳簲璇ユ彃鍏ュ埌鍝釜鍒嗗尯涓紝閬垮厤杩欑鎯呭喌鐨勫彂鐢燂紝灏遍渶瑕佸湪鎸囧畾鍒嗗尯鏂规鎴栬€呮柊澧炰竴涓垎鍖猴紝鏈€鍚庝竴涓垎鍖烘寚瀹氱殑鑼冨洿搴旇涓簃axvalue锛岃€屼笉鏄竴涓叿浣撶殑鍊笺€?/p>
鏍规嵁涓婇潰鍒涘缓鐨勮〃锛屽彲浠ユ坊鍔犱竴涓寖鍥翠负maxvalue鐨勫垎鍖猴紝鍛戒护濡備笅锛?/p>
mysql> alter table employees add partition (partition p4 values less than maxvalue);
濡傛灉鏈€鍚庝竴涓垎鍖烘寚瀹氱殑鑼冨洿鏄痬axvalue锛岄偅涔堝悗鏈熸兂瑕佹坊鍔犲垎鍖虹殑璇濓紝闇€瑕佷娇鐢ㄤ互涓嬫柟寮忥紙浣跨敤绫讳技浜庡垎鍖哄悎骞剁殑鎸囦护锛夛細
mysql> alter table employees reorganize partition p4 into
-> ( partition p03 values less than (25),
-> partition p04 values less than maxvalue
-> );
鍒犻櫎鍒嗗尯鐨勬寚浠ゅ涓嬶紙娉細褰撳垎鍖鸿鍒犻櫎锛岄偅涔堝垎鍖烘墍瀛樺偍鐨勬暟鎹篃灏嗚鍒犻櫎锛屾厧鐢紒锛侊紒锛夛細
mysql> alter table employees drop partition p2;
2銆丩IST鍒嗗尯
LIST鍒嗗尯绫讳技浜嶳ANGE鍒嗗尯锛屽尯鍒湪浜嶭IST鍒嗗尯鏄熀浜庡垪鍊煎尮閰嶄竴涓鏁e€奸泦鍚堜腑鐨勬煇涓€兼潵杩涜閫夋嫨銆侺IST鍒嗗尯閫氳繃浣跨敤鈥減artition by list锛坋xpr锛夆€濇潵瀹炵幇锛屽叾涓€渆xpr鈥濇槸鏌愬垪鍊兼垨涓€涓熀浜庢煇涓垪鍊笺€佸苟杩斿洖涓€涓暣鏁板€肩殑琛ㄨ揪寮忥紝鐒跺悗閫氳繃鈥渧alues in锛坴alue_list锛夆€濈殑鏂瑰紡鏉ュ畾涔夋瘡涓垎鍖猴紝鍏朵腑鈥渧alue_list鈥濇槸涓€涓€氳繃閫楀彿鍒嗛殧鐨勬暣鏁板垪琛ㄣ€?/p>
鍒涘缓LIST鍒嗗尯绫诲瀷涓句緥锛?/strong>
mysql> create table employees (
-> id int not null,
-> fname varchar(30),
-> lname varchar(30),
-> hired date not null default 鈥?970-01-01鈥?
-> separated date not null default 鈥?100-12-31鈥?
-> job_code int,
-> store_id int
-> )
-> partition by list(store_id)(
-> partition pNorth values in (3,5,6,9,17),
-> partition pEast values in (1,2,10,11,19,20),
-> partition pWest values in (4,12,13,14,18),
-> partition pCentral values in (7,8,15,16)
-> );
鍦ㄤ笂闈㈠垱寤虹殑琛ㄤ腑锛屽鏋滄彃鍏ヤ竴涓猻tore_id涓?2锛堜笉鍦ㄥ畾涔夌殑鍒嗗垪琛ㄤ腑锛夌殑鏁版嵁锛岄偅涔堝皢浼氭彃鍏ュけ璐ワ紝濡備笅锛?/p>
澶辫触鐨勫師鍥犲氨鏄細LIST鍒嗗尯娌℃湁绫讳技濡傗€淰ALUES LESS THAN MAXVALUE鈥濊繖鏍风殑鍖呭惈鍏朵粬鍊煎湪鍐呯殑瀹氫箟銆傚皢瑕佸尮閰嶇殑浠讳綍鍊奸兘
蹇呴』鍦ㄥ€煎垪琛ㄤ腑鎵惧埌銆?/p>
瑙e喅鍔炴硶灏辨槸澧炲姞鏈夎繖涓€肩殑鍒嗗尯锛屽涓?
mysql> alter table employees add partition (partition p4 values ins (22,23,24));
3銆丠ASH鍒嗗尯
杩欑妯″紡鍏佽DBA閫氳繃瀵硅〃鐨勪竴涓垨澶氫釜鍒楃殑Hash Key杩涜璁$畻锛屾渶鍚庨€氳繃杩欎釜Hash鐮佷笉鍚屾暟鍊煎搴旂殑鏁版嵁鍖哄煙杩涜鍒嗗尯銆?hash鍒嗗尯鐨勭洰鐨勬槸灏嗘暟鎹潎鍖€鐨勫垎甯冨埌棰勫厛瀹氫箟鐨勫悇涓垎鍖轰腑锛屼繚璇佸悇鍒嗗尯鐨勬暟鎹噺澶ц嚧涓€鑷淬€傚湪range鍜宭ist鍒嗗尯涓紝蹇呴』鏄庣‘鎸囧畾涓€涓粰瀹氱殑鍒楀€兼垨鍒楀€奸泦鍚堝簲璇ヤ繚瀛樺湪鍝釜鍒嗗尯涓紱鑰屽湪hash鍒嗗尯涓紝MySQL鑷姩瀹屾垚杩欎簺宸ヤ綔锛岀敤鎴锋墍瑕佸畾涓€涓垪鍊兼垨鑰呰〃杈惧紡锛屼互鍙婃寚瀹氳鍒嗗尯鐨勮〃灏嗚琚垎鍓叉垚鐨勫垎鍖烘暟閲忋€?/p>
1锛夊垱寤篽ash鍒嗗尯鐨勮〃
mysql> create table t_hash(a int(11),b datetime) partition by hash(year(b)) partitions 4;
涓婅堪鍒涘缓琛ㄧ殑鍛戒护涓紝浣跨敤浜唝ear鍑芥暟鏉ユ彁鍙朾鍒椾腑鐨勫勾浠芥潵鍋氬垎鍖虹殑渚濇嵁锛岄€氳繃partitions鏉ユ寚瀹氶渶瑕?涓垎鍖恒€?/p>
2锛夋彃鍏ユ祴璇曟暟鎹?/h4>
mysql> insert into t_hash values(1,鈥?010-04-01鈥?;
mysql> insert into t_hash values(1,鈥?010-04-01鈥?;
涓婅堪鎸囦护鎻掑叆鐨勬暟鎹皢琚瓨鏀惧湪p2鍒嗗尯锛岃绠楁柟娉曞涓嬶細
鏌ョ湅information_schema搴撲腑鐨刾artitions涔熷彲浠ユ煡鐪嬪埌p2鍒嗗尯涓細鏈?鏉¤褰曪紝濡備笅锛?/p>
mysql> select * from information_schema.partitions where table_schema=鈥榯est001鈥?and table_name=鈥榯_hash鈥榎G
杩斿洖缁撴灉濡備笅锛?/p>
涓婇潰鐨勪緥瀛愬苟涓嶈兘鎶婃暟鎹潎鍖€鐨勫垎甯冨埌鍚勪釜鍒嗗尯锛屽洜涓烘寜鐓EAR鍑芥暟杩涜鐨勶紝璇ュ€兼湰韬槸绂绘暎鐨勩€傚鏋滃杩炵画鐨勫€艰繘琛孒ASH鍒嗗尯锛屽鑷闀跨殑涓婚敭锛屽垯鍙互杈冨ソ鍦板皢鏁版嵁骞冲潎鍒嗗竷銆?/p>
4銆乲ey鍒嗗尯
key鍒嗗尯鍜宧ash鍒嗗尯鐩镐技锛屼笉鍚屽湪浜巋ash鍒嗗尯鏄敤鎴疯嚜瀹氫箟鍑芥暟杩涜鍒嗗尯锛宬ey鍒嗗尯浣跨敤mysql鏁版嵁搴撴彁渚涚殑鍑芥暟杩涜鍒嗗尯锛孨DB cluster浣跨敤MD5鍑芥暟鏉ュ垎鍖猴紝瀵逛簬鍏朵粬瀛樺偍寮曟搸mysql浣跨敤鍐呴儴鐨刪ash鍑芥暟銆?/p>
鍒涘缓涓€涓猭ey鍒嗗尯鐨勮〃锛?/p>
mysql> create table t_key(a int(11), b datetime) partition by key(b) partitions 4;
濡傛灉鍚庢湡闇€瑕佹柊澧炲垎鍖猴紝浣跨敤浠ヤ笅鎸囦护鍗冲彲锛?/p>
mysql> alter table t_key add partition partitions 5;
涓婅堪鎸囦护鏄柊澧炰簡5涓垎鍖猴紝涔熷氨鏄锛岀幇鍦╰_key杩欎釜琛ㄤ竴鍏辨湁9涓垎鍖轰簡銆?/p>
娉細 mysql-5.5寮€濮嬫敮鎸丆OLUMNS鍒嗗尯锛屽彲瑙嗕负RANGE鍜孡IST鍒嗗尯鐨勮繘鍖栵紝COLUMNS鍒嗗尯鍙互鐩存帴浣跨敤闈炴暣褰㈡暟鎹繘琛屽垎鍖恒€侰OLUMNS鍒嗗尯鏀寔浠ヤ笅鏁版嵁绫诲瀷锛?鎵€鏈夋暣褰紝濡侷NT SMALLINT
TINYINT BIGINT銆侳LOAT鍜孌ECIMAL鍒欎笉鏀寔銆?鏃ユ湡绫诲瀷锛屽DATE鍜孌ATETIME銆傚叾浣欐棩鏈熺被鍨嬩笉鏀寔銆傚瓧绗︿覆绫诲瀷锛屽CHAR銆乂ARCHAR銆丅INARY鍜孷ARBINARY銆侭LOB鍜孴EXT绫诲瀷涓嶆敮鎸併€?COLUMNS鍙互浣跨敤澶氫釜鍒楄繘琛屽垎鍖恒€?/strong>
5銆丮ySQL鍒嗚〃鍜屽垎鍖虹殑鍖哄埆
1锛?瀹炵幇鏂瑰紡涓?/h4>
- mysql鐨勫垎琛ㄦ槸鐪熸鐨勫垎琛紝涓€寮犺〃鍒嗘垚寰堝琛ㄥ悗锛屾瘡涓€涓皬琛ㄩ兘鏄畬鏁寸殑涓€寮犺〃锛岄兘瀵瑰簲涓変釜鏂囦欢锛屼竴涓?MYD鏁版嵁鏂囦欢锛?MYI绱㈠紩鏂囦欢锛?frm琛ㄧ粨鏋勬枃浠躲€?/li>
- 鍒嗗尯涓嶄竴鏍凤紝涓€寮犲ぇ琛ㄨ繘琛屽垎鍖哄悗锛屽畠杩樻槸涓€寮犺〃锛屼笉浼氬彉鎴愪簩寮犺〃锛屼絾鏄畠瀛樻斁鏁版嵁鐨勫尯鍧楀彉澶氫簡
2锛夋暟鎹鐞嗕笂
- 鍒嗚〃鍚庯紝鏁版嵁閮芥槸瀛樻斁鍦ㄥ垎琛ㄩ噷锛屾€昏〃鍙槸涓€涓澹筹紝瀛樺彇鏁版嵁鍙戠敓鍦ㄤ竴涓竴涓殑鍒嗚〃閲岄潰銆?/li>
- 鍒嗗尯鍛紝涓嶅瓨鍦ㄥ垎琛ㄧ殑姒傚康锛屽垎鍖哄彧涓嶈繃鎶婂瓨鏀炬暟鎹殑鏂囦欢鍒嗘垚浜嗚澶氬皬鍧楋紝鍒嗗尯鍚庣殑琛ㄥ憿锛岃繕鏄竴寮犺〃锛屾暟鎹鐞嗚繕鏄敱鑷繁鏉ュ畬鎴愩€?/li>
3锛夋彁楂樻€ц兘涓?/h4>
- 鍒嗚〃鍚庯紝鍗曡〃鐨勫苟鍙戣兘鍔涙彁楂樹簡锛岀鐩業/O鎬ц兘涔熸彁楂樹簡銆傚洜涓烘煡瀵讳竴娆℃墍鑺辩殑鏃堕棿鍙樼煭浜嗭紝濡傛灉鍑虹幇楂樺苟鍙戠殑璇濓紝鎬昏〃鍙互鏍规嵁涓嶅悓鐨勬煡璇紝灏嗗苟鍙戝帇鍔涘垎鍒颁笉鍚岀殑灏忚〃閲岄潰銆?/li>
- mysql鎻愬嚭浜嗗垎鍖虹殑姒傚康锛屼富瑕佹槸鎯崇獊鐮寸鐩業/O鐡堕锛屾兂鎻愰珮纾佺洏鐨勮鍐欒兘鍔涳紝鏉ュ鍔爉ysql鎬ц兘銆?/li>
- 鍦ㄨ繖涓€鐐逛笂锛屽垎鍖哄拰鍒嗚〃鐨勪晶閲嶇偣涓嶅悓锛屽垎琛ㄩ噸鐐规槸瀛樺彇鏁版嵁鏃讹紝濡備綍鎻愰珮mysql骞跺彂鑳藉姏涓婏紱鑰屽垎鍖哄憿锛屽浣曠獊鐮寸鐩樼殑璇诲啓鑳藉姏锛屼粠鑰岃揪鍒版彁楂榤ysql鎬ц兘鐨勭洰鐨勩€?/li>
4锛夊疄鐜扮殑闅炬槗搴︿笂
- 鍒嗚〃鐨勬柟娉曟湁寰堝锛岀敤merge鏉ュ垎琛紝鏄渶绠€鍗曠殑涓€绉嶆柟寮忋€傝繖绉嶆柟寮忚窡鍒嗗尯闅炬槗搴﹀樊涓嶅锛屽苟涓斿绋嬪簭浠g爜鏉ヨ鍙互鍋氬埌閫忔槑鐨勩€傚鏋滄槸鐢ㄥ叾浠栧垎琛ㄦ柟寮忓氨姣斿垎鍖洪夯鐑︿簡銆?/li>
- 鍒嗗尯瀹炵幇鏄瘮杈冪畝鍗曠殑锛屽缓绔嬪垎鍖鸿〃锛屽拰寤哄钩甯哥殑琛ㄦ病浠€涔堝尯鍒紝骞朵笖瀵瑰紑浠g爜绔潵璇存槸閫忔槑鐨勩€?/li>
5锛?鍏朵粬鍖哄埆
- 閮借兘鎻愰珮mysql鐨勬€ч珮锛屽湪楂樺苟鍙戠姸鎬佷笅閮芥湁涓€涓壇濂界殑琛ㄧ幇銆?/li>
- 鍒嗚〃鍜屽垎鍖轰笉鐭涚浘锛屽彲浠ョ浉浜掗厤鍚堢殑锛屽浜庨偅浜涘ぇ璁块棶閲忥紝骞朵笖琛ㄦ暟鎹瘮杈冨鐨勮〃锛屾垜浠彲浠ラ噰鍙栧垎琛ㄥ拰鍒嗗尯缁撳悎鐨勬柟寮忥紝璁块棶閲忎笉澶э紝浣嗘槸琛ㄦ暟鎹緢澶氱殑琛紝鎴戜滑鍙互閲囧彇鍒嗗尯鐨勬柟寮忕瓑銆?/li>
- 鍒嗚〃鎶€鏈槸姣旇緝楹荤儲鐨勶紝闇€瑕佹墜鍔ㄥ幓鍒涘缓瀛愯〃锛宎pp鏈嶅姟绔鍐欐椂鍊欓渶瑕佽绠楀瓙琛ㄥ悕銆傞噰鐢╩erge濂戒竴浜涳紝浣嗕篃瑕佸垱寤哄瓙琛ㄥ拰閰嶇疆瀛愯〃闂寸殑union鍏崇郴銆?/li>
- 琛ㄥ垎鍖虹浉瀵逛簬鍒嗚〃锛屾搷浣滄柟渚匡紝涓嶉渶瑕佸垱寤哄瓙琛ㄣ€?/li>
6銆侀檮鍔狅細濡備綍瀹炵幇灏嗗垎鍖烘斁鍦ㄤ笉鍚岀殑鐩綍涓嬭繘琛屽瓨鍌?/h3>
- mysql鐨勫垎琛ㄦ槸鐪熸鐨勫垎琛紝涓€寮犺〃鍒嗘垚寰堝琛ㄥ悗锛屾瘡涓€涓皬琛ㄩ兘鏄畬鏁寸殑涓€寮犺〃锛岄兘瀵瑰簲涓変釜鏂囦欢锛屼竴涓?MYD鏁版嵁鏂囦欢锛?MYI绱㈠紩鏂囦欢锛?frm琛ㄧ粨鏋勬枃浠躲€?/li>
- 鍒嗗尯涓嶄竴鏍凤紝涓€寮犲ぇ琛ㄨ繘琛屽垎鍖哄悗锛屽畠杩樻槸涓€寮犺〃锛屼笉浼氬彉鎴愪簩寮犺〃锛屼絾鏄畠瀛樻斁鏁版嵁鐨勫尯鍧楀彉澶氫簡
- 鍒嗚〃鍚庯紝鏁版嵁閮芥槸瀛樻斁鍦ㄥ垎琛ㄩ噷锛屾€昏〃鍙槸涓€涓澹筹紝瀛樺彇鏁版嵁鍙戠敓鍦ㄤ竴涓竴涓殑鍒嗚〃閲岄潰銆?/li>
- 鍒嗗尯鍛紝涓嶅瓨鍦ㄥ垎琛ㄧ殑姒傚康锛屽垎鍖哄彧涓嶈繃鎶婂瓨鏀炬暟鎹殑鏂囦欢鍒嗘垚浜嗚澶氬皬鍧楋紝鍒嗗尯鍚庣殑琛ㄥ憿锛岃繕鏄竴寮犺〃锛屾暟鎹鐞嗚繕鏄敱鑷繁鏉ュ畬鎴愩€?/li>
- 鍒嗚〃鍚庯紝鍗曡〃鐨勫苟鍙戣兘鍔涙彁楂樹簡锛岀鐩業/O鎬ц兘涔熸彁楂樹簡銆傚洜涓烘煡瀵讳竴娆℃墍鑺辩殑鏃堕棿鍙樼煭浜嗭紝濡傛灉鍑虹幇楂樺苟鍙戠殑璇濓紝鎬昏〃鍙互鏍规嵁涓嶅悓鐨勬煡璇紝灏嗗苟鍙戝帇鍔涘垎鍒颁笉鍚岀殑灏忚〃閲岄潰銆?/li>
- mysql鎻愬嚭浜嗗垎鍖虹殑姒傚康锛屼富瑕佹槸鎯崇獊鐮寸鐩業/O鐡堕锛屾兂鎻愰珮纾佺洏鐨勮鍐欒兘鍔涳紝鏉ュ鍔爉ysql鎬ц兘銆?/li>
- 鍦ㄨ繖涓€鐐逛笂锛屽垎鍖哄拰鍒嗚〃鐨勪晶閲嶇偣涓嶅悓锛屽垎琛ㄩ噸鐐规槸瀛樺彇鏁版嵁鏃讹紝濡備綍鎻愰珮mysql骞跺彂鑳藉姏涓婏紱鑰屽垎鍖哄憿锛屽浣曠獊鐮寸鐩樼殑璇诲啓鑳藉姏锛屼粠鑰岃揪鍒版彁楂榤ysql鎬ц兘鐨勭洰鐨勩€?/li>
4锛夊疄鐜扮殑闅炬槗搴︿笂
- 鍒嗚〃鐨勬柟娉曟湁寰堝锛岀敤merge鏉ュ垎琛紝鏄渶绠€鍗曠殑涓€绉嶆柟寮忋€傝繖绉嶆柟寮忚窡鍒嗗尯闅炬槗搴﹀樊涓嶅锛屽苟涓斿绋嬪簭浠g爜鏉ヨ鍙互鍋氬埌閫忔槑鐨勩€傚鏋滄槸鐢ㄥ叾浠栧垎琛ㄦ柟寮忓氨姣斿垎鍖洪夯鐑︿簡銆?/li>
- 鍒嗗尯瀹炵幇鏄瘮杈冪畝鍗曠殑锛屽缓绔嬪垎鍖鸿〃锛屽拰寤哄钩甯哥殑琛ㄦ病浠€涔堝尯鍒紝骞朵笖瀵瑰紑浠g爜绔潵璇存槸閫忔槑鐨勩€?/li>
5锛?鍏朵粬鍖哄埆
- 閮借兘鎻愰珮mysql鐨勬€ч珮锛屽湪楂樺苟鍙戠姸鎬佷笅閮芥湁涓€涓壇濂界殑琛ㄧ幇銆?/li>
- 鍒嗚〃鍜屽垎鍖轰笉鐭涚浘锛屽彲浠ョ浉浜掗厤鍚堢殑锛屽浜庨偅浜涘ぇ璁块棶閲忥紝骞朵笖琛ㄦ暟鎹瘮杈冨鐨勮〃锛屾垜浠彲浠ラ噰鍙栧垎琛ㄥ拰鍒嗗尯缁撳悎鐨勬柟寮忥紝璁块棶閲忎笉澶э紝浣嗘槸琛ㄦ暟鎹緢澶氱殑琛紝鎴戜滑鍙互閲囧彇鍒嗗尯鐨勬柟寮忕瓑銆?/li>
- 鍒嗚〃鎶€鏈槸姣旇緝楹荤儲鐨勶紝闇€瑕佹墜鍔ㄥ幓鍒涘缓瀛愯〃锛宎pp鏈嶅姟绔鍐欐椂鍊欓渶瑕佽绠楀瓙琛ㄥ悕銆傞噰鐢╩erge濂戒竴浜涳紝浣嗕篃瑕佸垱寤哄瓙琛ㄥ拰閰嶇疆瀛愯〃闂寸殑union鍏崇郴銆?/li>
- 琛ㄥ垎鍖虹浉瀵逛簬鍒嗚〃锛屾搷浣滄柟渚匡紝涓嶉渶瑕佸垱寤哄瓙琛ㄣ€?/li>
6銆侀檮鍔狅細濡備綍瀹炵幇灏嗗垎鍖烘斁鍦ㄤ笉鍚岀殑鐩綍涓嬭繘琛屽瓨鍌?/h3>
鍏堝湪鏈湴鍒涘缓濂介渶瑕佺殑鐩綍锛?/p>
[root@mysql ~]# mkdir /data
[root@mysql ~]# chown -R mysql.mysql /data
鐒跺悗鍒涘缓琛ㄦ椂锛屾寚瀹歞ata directory灏卞彲浠ワ紝濡備笅锛?/p>
mysql> create table user(
-> id int not null auto_increment,
-> name varchar(30) not null default 鈥樷€?
-> primary key(id)) default charset=utf8 auto_increment=1
-> partition by range(id)(
-> partition p1 values less than (3) data directory 鈥?data/area1鈥?
-> partition p2 values less than (6) data directory 鈥?data/area2鈥?
-> partition p3 values less than (9) data directory 鈥?data/area3鈥?;
鏌ョ湅鏈湴鐩綍锛屽垯浼氬彂鐜拌嚜鍔ㄥ垱寤轰簡鐩稿簲鐨勫瓨鏀炬暟鎹殑鐩綍锛屽涓嬶細
娉細浣跨敤mysql榛樿鐨勫瓨鍌ㄥ紩鎿巌nodb鏃跺€欙紝鍙渶瑕佹寚瀹歞ata directory 灏卞彲浠ワ紝鍥犱负inodb鐨勬暟鎹拰绱㈠紩鍦ㄤ竴涓枃浠朵腑銆備絾鏄垱寤鸿〃鏍兼椂鎸囧畾engine=myisam鏃讹紝淇敼鍒嗗尯鐨勫瓨鍌ㄤ綅缃紝闇€瑕佸悓鏃舵寚瀹歞ata directory鍜宨ndex directory銆?/strong>
鈥斺€斺€斺€斺€斺€斺€斺€?鏈枃鑷虫缁撴潫锛屾劅璋㈤槄璇?鈥斺€斺€斺€斺€斺€斺€斺€?/p>
以上是关于MySQL鍒嗗尯绫诲瀷的主要内容,如果未能解决你的问题,请参考以下文章
DOM-Text绫诲瀷銆丆omment绫诲瀷銆丆DATASection绫诲瀷銆丏ocumentType绫诲瀷銆丏ocumentFragment绫诲瀷銆丄ttr绫诲瀷
centos7纭洏涓夋鎿嶄綔( 鍒嗗尯銆佹牸寮忓寲銆佹寕杞?