Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

MySQL Partition

×÷ÕߣºÀÏÍõ Èý¹úÑÝÒ忪ƪһÓïµÀÆÆ£ººÏ¾Ã±Ø·Ö£¡MySQLµÄʹÓÃÒàÊÇÈç´Ë£¬Ãæ¶ÔÓ¦ÓÃÖÐÔ½À´Ô½ÅÓ´óµÄÊý¾ÝÁ¿£¬×îʱ÷ֵĽâ¾ö·½°¸ÊÇShard£¬²»¹ýËüµÄ¸´ÔÓÐÔ²¢²»ÊÇÿ¸ö³ÌÐòÔ±¶¼ÄܼÝÔ¦µÄ£¬Èç¹û°Ñ¼Ü¹¹µÄÑݱä±È×÷ÉúÃüµÄ½ø»¯£¬ÄÇôShard¿ÉÒÔ¿´×öÊDz¸È鶯ÎºÜ¶à¼Ü¹¹×îºóÖ®ËùÒÔʧ°Ü£¬¾ÍÊÇÒòΪËüÃDz½×ÓÂõµÃÌ«´ó£¬Ïë´ÓԭʼÉúÃüÖ±½Ó½ø»¯³É²¸È鶯ÎÊâ²»ÖªÕâÖм仹ÓÐÅÀÐж¯ÎïµÈ±Ø¾­½×¶Î¡£
ÔÚMySQLûÓÐÖ§³ÖPartition֮ǰ£¬Èç¹ûÏë°ÑÊý¾Ý·Ö¶øÖÎÖ®£¬¿ÉÒÔʹÓÃMySQLÌṩµÄMergeµÄÒýÇ棬Àý×Ó£º
ÏȽ¨Á¢Á½¸ö½á¹¹Ò»ÑùµÄMyISAM±í£º
CREATE TABLE foo_1 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
created DATETIME
) ENGINE=MyISAM;
CREATE TABLE foo_2 (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
created DATETIME
) ENGINE=MyISAM;
ÔÙ½¨Á¢MERGE±í£º
CREATE TABLE foo (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
created DATETIME
) ENGINE=MERGE UNION=(foo_1, foo_2) INSERT_METHOD=LAST;
¶Ôµ÷ÓÃÕ߶øÑÔ£¬MERGE±í¾ÍÏñÒ»¸öUNIONÓï¾äÒ»Ñù£¬ÕâÑùȷʵºÜ·½±ã£¬²»¹ýËüÓкܶàÈõµã£º
Ê×ÏÈ£¬Ëü²»ÊÇÍêȫ͸Ã÷µÄ£¬ÐèÒªÓÐÈô¸É»ù´¡±í£¨foo_1£¬foo_2£©µÄ´æÔÚ£¬¶øÇÒ»ù´¡±í±ØÐëÊÇMyISAM±íÀàÐÍ£¬ÁíÍ⣬¶ÔÓÚMERGEÀ´Ëµ£¬²»Ö§³ÖÔ¼Êø£¬±ÈÈçÉÏÃæµÄfoo±í¶¨ÒåÖУ¬ËäÈ»°Ñid¶¨ÒåΪÖ÷¼ü£¬µ«ÊÇÈç¹ûÎÒÃÇÔÚfoo_1ºÍfoo_2·Ö±ð²åÈëÒ»¸öÏàͬidµÄ»°£¬foo±íÒ²²»»á±¨´í¡£
ÑÔ¹éÕý´«£¡MySQL´Ó5.1.3¿ªÊ¼Ö§³ÖPartition£¬Äã¿ÉÒÔʹÓÃÈçÏÂÃüÁîÀ´È·ÈÏÄãµÄ°æ±¾ÊÇ·ñÖ§³ÖPartition£º
mysql> SHOW VARIABLES LIKE '%partition%';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| have_partitioning | YES   |
+-------------------+-------+
MySQLÖ§³ÖRANGE£¬LIST£¬HASH£¬KEY·ÖÇøÀàÐÍ£¬ÆäÖÐÒÔRANGE×îΪ³£Óãº
CREATE TABLE foo (
id INT NOT NULL AUTO_INCREMENT,
created DATETIME,
PRIMARY KEY(id, created)
) ENGINE=INNODB PARTITION BY RANGE (TO_DAYS(created)) (
PARTITION foo_1 VALUES LESS THAN (TO_DAYS('2009-01-01')),
PARTITION foo_2 VALUES LESS THAN (TO_DAYS('2010-01-01'))
)
¼´±ã´´½¨Íê·ÖÇø£¬Ò²¿ÉÒÔÔÚºóÆÚ¹ÜÀí£¬±ÈÈç˵Ìí¼ÓÒ»¸öеķÖ


Ïà¹ØÎĵµ£º

Æô¶¯ºÍ¹Ø±ÕMySQLµÄ·½·¨

£¨1£©Æô¶¯
     MySQL°²×°Íê³ÉºóÆô¶¯ÎļþmysqlÔÚ/etc/init.dĿ¼Ï£¬ÔÚÐèÒªÆô¶¯MySQL·þÎñʱÔËÐÐÏÂÃæÃüÁî¼´¿É¡£ [root@test1 init.d]# /etc/init.d/mysql start
£¨2£©Í£Ö¹
      /usr/bin/mysqladmin -u root -p shutdown
£¨3£©ÉèÖÃMySQL×Ô¶¯Æô¶¯
1£©²ì¿´mysqlÊÇ·ñÔÚ×Ô¶ ......

ÍùMYSQLÀïдÖÐÎľͱäÎʺţ¿

ÎÊÌâ½â¾öÁË£¬Ô­ÒòÊÇÔÚmy.cnfÖÐȱÉÙÁËÈçÏ´úÂ룺
[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
Èç¹û²»¼ÓÒÔÉÏ´úÂ룬ÄÇô¼´±ãMYSQL±àÒ밲װʱָ¶¨µÄ±àÂëÊÇUTF8£¬ÄÇôÔÚ½¨¿âʱÆäĬÈϱàÂëÈÔÊÇLATIN1£¬¶øÓÉÓÚ×Ö·û¼¯µÄ¼Ì³ÐÐÔ£¬¿âÖеıíÒ²ÊÇLATIN1µÄÁË¡£
ÕâÀïÁм¸ÌõÃüÁ´ó¼Ò¿ÉÒÔ×Ô¼ºÊÔÏ ......

mysqlÖØ×°ÎÊÌâ½â¾ö·½°¸

mysqlfrontÁ¬½Óʱ³öÏÖ“³ÌÐò×¢²áʱ¼äµ½ÆÚÁË£¬³ÌÐò½«±»ÏÞÖÆÔÚµ­Ä£Ê½ÏÂÔËÐДÕâ¸öÎÊÌâʱ£¬²»ÓÃÖØ×°£¬Ö»ÐèÔÚMysql Front µÄ°ïÖú²Ëµ¥ÏîµÄµÇ¼ÇÀïÊäÈëÒÔÏÂMysql FrontµÄ×¢²áÂë¼´¿É¡£
MysqlFront×¢²áÂëÈçÏ£º
0hjwKUddagvS41S9TIb8EwuiXwo4+dlr
t8z9sq/YRlP9e0zTx7jVlriD8bWlwoJM
TRlllybJ0+wce5rRZGaMBnWJH5H0/Pwv ......

ÆäËûÊý¾Ý¿âÄ£ÄâʵÏÖmysqlµÄlimitÓï·¨

¼ÙÈçÎÒÓиöuser±í,ÎÒÏë²éѯ·ûºÏijЩÌõ¼þµÄµÚ50¸öÓû§¿ªÊ¼µÄ10¸öÓû§,ÇÒ²»ÄÜʹÓÃidºÅbetween andÄÇÑù²éѯ,Ó¦¸ÃÔõôдSQLÓï¾ä?
¡¡¡¡ÔÚmysqlÊý¾Ý¿âÖÐÓÐlimit,offsetÓï¾ä¿ÉÒÔ·½±ãµÄʵÏÖ,ÄÇôÔÚSQL serverÖÐÄØ?SQL ServerÊÇ·ñÖ§³ÖlimitºÍoffsetÓï¾äÄØ?
select top 10 * from
(select top 60 * from [user] order by userid) a ......

ExcelÊý¾ÝʹÓÃjdbcÖ±½Ó²åÈëMysqlÊý¾Ý¿â

import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import jxl.*;
public class ImportExcel {
public static void main(String[] args) {
File importExcel = new File("D:\\test\\test.xls");
try {
// Êý¾Ý¿âÁ¬½Ó
Class.forNa ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ