SQL Databases Don't Scale £¨¼òÒ룩
ÎÒ¾³£ÎʵÄÒ»¸öÎÊÌâÊÇ£ºÄãÊÇÈçºÎÀ´À©Õ¹SQL DatabaseµÄ£¿ÓкܶàµÄ·½·¨¿ÉÒÔ×öµ½£¬±ÈÈçʹÓûº´æ£¬¹²Ïí»òÕßÓÃÆäËûµÄ¼¼Êõ½«Ñ¹Á¦´ÓÊý¾Ý¿âÊÍ·Å£¬µ«Êµ¼ÊÉÏÎÒÃÇûÓС£SQL Database´Ó¸ù±¾ÉÏÀ´ËµÊDz»¾ßÓÐÀ©Õ¹ÐԵģ¬ÎÒÃÇҲûÓÐħ·¨Ê¹ËüºöÈ»¾ßÓÐÀ©Õ¹ÐÔ¡£
ʲôÊÇÀ©Õ¹ÐÔ£¿
±ØÐë¾ßÓм¸Ï¼¸µã£º
ºáÏòÀ©Õ¹£º¸ü¶àµÄserver¿ÉÒÔ´øÀ´¸ü¸ßµÄÐÔÄÜ¡£
¶ÔÓ¦ÓóÌÐòµÄ͸Ã÷ÐÔ£ºÀ©Õ¹µÄʵÏÖ¶ÔÓÚÒµÎñÂß¼À´ËµÊÇ͸Ã÷µÄ£¬Âß¼ÉÏÖ»ÓÐÒ»¸öserver·þÎñÓÚÒµÎñ¡£
µ¥µãʧ°Ü²»»áµ¼Ö¹ÊÕÏ£ºµ¥¸öserver»òÕß½ÚµãµÄå´»ú²»»áµ¼ÖÂϵͳµÄʧ°Ü¡£
½ÓÏÂÀ´£¬ÈÃÎÒÃÇ¿´Ò»Ð©¼¼ÊõÈçºÎ“À©Õ¹”SQL DatabaseÒÔ¼°ËûÃÇΪʲôûÓдﵽÒÔÉϼ¸µã¡£
×ÝÏòÀ©Õ¹
Ò»ÖÖ·½·¨È¥À©Õ¹SQL DatabaseÊÇÂò¸ü´óµÄserver»òÕß´æ´¢¡£Õâ´øÀ´µÄÎÊÌâÊÇ£º
ÔËÊä±äµÄ¸´ÔÓ
ÔÀ´µÄ»úÆ÷Âäºó£¬Éý¼¶±äµÄÀË·Ñ×ÊÔ´
Äã²»ÖªµÀµ½µ×ÀàËÆÈÝÁ¿ÕâÑùµÄÎÊÌâ»á±äµÄÓжà´ó
Õâ¸ö²»·ûºÏÀ©Õ¹ÐԵĵÚÒ»Ìõ¡£
·ÖÇø£¬¹²Ïí
¸ù¾ÝÂß¼¶ÔÊý¾Ý½øÐзÖÇø¡£ÕâÖÖ·½·¨Ò²ÊÇ×ÝÏòÀ©Õ¹µÄÒ»ÖÖ·½·¨£¬Ëü½ôÃÜÒÀÀµÓÚÓ¦Óò¢ÇÒÄãÐèÒª×ÐϸµÄÈ¥¼Æ»®ÄãµÄschema¡£
ÕâÖÖ·½·¨¶ÔÓÚ³ÌÐòÀ´ËµÊDz»Í¸Ã÷µÄ£¬±ØÐëºÍÒµÎñ½áºÏÔÚÒ»Æð£¬²»·ûºÏÀ©Õ¹ÐԵĵڶþÌõ¡£¸üÑÏÖØµÄÎÊÌâÊÇ£¬Êý¾Ý¿âÊǹØÏµÊý¾Ý¿â£¬´æ´¢µÄÊý¾ÝÒ²ÊÇÏà¹ØµÄ£¬ÕâÑùµÄÏà¹ØÊý¾Ý·Ö²¼ÔÚ¶à¸öserverÉÏ£¬ÄãÐèҪΪÕâÑùÖØ¸´µÄ¹ØÏµ·þÎñ£¬¶øÇÒµ±ËûÃÇ·µ»ØÊ±±ØÐëÔÚ¿Í»§¶ËÖØÐ¹¹½¨ÕâÑùµÄ¹ØÏµ¡£
Ö»¶ÁµÄSlave
MySqlµÄɱÊÖ¼¶Ó¦ÓþÍÊÇÅäÖ÷½±ãµÄmaster-slave¸´ÖÆ£¬Äã¿ÉÒÔÓÃÒ»¸öread-only-slaveÀ´´¦ÀíÄãµÄ¶ÁÓ¦Óöø°ÑËùÓеÄinsert update delete¶¼ÓÉmasterÀ´´¦Àí¡£
ÕâÖÖ·½Ê½ÊÇ×îºÃµÄÀ©Õ¹·½Ê½£¬ÕâÒ²ÊǺܶà´óÐ͵ÄMySqlÔÚʹÓõķ½·¨¡£¶ÔÓÚ¶ÁÀ©Õ¹À´ËµÕâÑùµÄ·½·¨ÊǺõ쬶ÔÓÚдÀ©Õ¹À´ËµÕâÑùµÄЧÂÊ»¹ÊDz»Ðе쬶øÇÒµ±Äãά»¤master serverµÄʱºò£¬Ò²»áÔì³ÉÕû¸öϵͳµÄå´»ú¡£
ÔÎÄ£ºhttp://adam.blog.heroku.com/past/2009/7/6/sql_databases_dont_scale/
Ïà¹ØÎĵµ£º
SQL Server7.0Êý¾Ý¿â£ºÊý¾Ý²Ö¿â¡¢Êý¾Ý¸´ÖÆ¡¢·Ö²¼Ê½Êý¾Ý¿âÓ¦ÓóÌÐò¡¢IntelnetºÍIntranetÓ¦Óú͹ÜÀí¹¤¾ß£»
°²×°¼ì²â£º1¡¢net start mssqlsever;
2¡¢osql /usa /p ;
......
×î½ü¸Õѧ»áÔÚVB2008 ÖÐʹÓòÎÊý»¯SQLÓï¾ä£¬ÓÚÊÇÂíÉÏÓõ½´úÂëÖУ¬È´Åöµ½²é²»µ½ÈκÎÊý¾ÝµÄÇé¿ö£¬¾À½áÁ˺ü¸Ì죬»¹ÊÇûÓиãÃ÷°×£¬²îµãÍÂѪ¡£²»µÃÒÑ»¹ÊÇÏÈÔÚ´úÂëÖÐʹÓÃ×Ö·û´®Æ´½ÓµÄSQLÓï¾ä¡£
°üº¬²ÎÊý»¯SQLÓï¾äµÄ´úÂëÈçÏ£º
Dim cmSl As N ......
SQL×¢Èë¹¥»÷µÄΣº¦ÐԺܴó¡£ÔÚ½²½âÆä·ÀÖ¹°ì·¨Ö®Ç°£¬Êý¾Ý¿â¹ÜÀíÔ±ÓбØÒªÏÈÁ˽âÒ»ÏÂÆä¹¥»÷µÄÔÀí¡£ÕâÓÐÀûÓÚ¹ÜÀíÔ±²ÉÈ¡ÓÐÕë¶ÔÐԵķÀÖδëÊ©¡£
¡¡¡¡Ò»¡¢ SQL×¢Èë¹¥»÷µÄ¼òµ¥Ê¾Àý¡£
¡¡¡¡statement := "SELECT * from Users WHERE Value= " + a_variable + "
¡¡¡¡ÉÏÃæÕâÌõÓï¾äÊÇºÜÆÕͨµÄÒ»ÌõSQLÓï¾ä£¬ËûÖ÷Ҫʵ ......
SQL¾ÛºÏº¯
±êÇ©£ºsql¾ÛºÏº¯Êý ÔÓ̸
¾ÛºÏº¯Êý£º
1.AVG ·µ»Ø×éÖÐµÄÆ½¾ùÖµ£¬¿ÕÖµ½«±»ºöÂÔ¡£
ÀýÈ磺use northwind // ²Ù×÷northwindÊý¾Ý¿â
Go
Select avg (unitprice) //´Ó±íÖÐÑ¡ÔñÇóunitpriceµÄƽ¾ùÖµ
& ......
MYSQL¿ÉÒÔÔÚ¿ØÖÆÌ¨Ï½øÐвÙ×÷£¬ÀûÓÃÃüÁî
SQL´úÂë
mysql -h localhost -u root -p123456
¾Í¿ÉÒԵǽMYSQLµÄ¿ØÖÆÌ¨¡£
sql serverÒ²ÌṩÁË¿ØÖÆÌ¨ÏµIJÙ×÷¹¦ÄÜ¡£
ÔÚSQL SERVERµÄ binnĿ¼Ï£¬ÌṩÁËosql.exeÓëisql.exeÕâÁ½¸öÎļþ¡£
ÕâÁ½¸ö³ÌÐò¶¼ÌṩÁË·ÃÎÊSQL SERVERµÄ¹¦ÄÜ£¬ÕâÁ ......