SQL Server2008ÐÐÊý¾ÝºÍÒ³Êý¾ÝѹËõ½âÃÜ
SQL Server2008ÐÐÊý¾ÝºÍÒ³Êý¾ÝѹËõ½âÃÜ
Êý¾ÝѹËõÒâζ׿õСÊý¾ÝµÄÓдÅÅÌÕ¼ÓÃÁ¿£¬ËùÒÔÊý¾ÝѹËõ¿ÉÒÔÓÃÔÚ±í£¬¾Û¼¯Ë÷Òý£¬·Ç¾Û¼¯Ë÷Òý£¬ÊÓͼË÷Òý»òÊÇ·ÖÇø±í£¬·ÖÇøË÷ÒýÉÏ¡£2.Ç°±êѹËõ£ºÃ¿Ò»Ò³ÖеÄËùÓÐÁУ¬ÔÚÐбêÍ·ÏÂÃ棬ÿÐж¼´æ´¢×ÅÒ»¸öÐж¨ÒåÖµ£¬Ñ¹Ëõºó£¬ËùÓÐÐеĶ¨ÒåÖµ¶¼±»Ìæ»»³ÉÐÐÍ·ÖµµÄÒýÓá£
¡¡¡¡±¾ÎĽ«Îª´ó¼Ò½éÉÜSQL Server 2008ÐÐÊý¾ÝºÍÒ³Êý¾ÝµÄһЩ´¦Àí·½·¨£¬Ï£ÍûÄܶÔDBAµÄ¹ÜÀí¹¤×÷ÓÐËù°ïÖú¡£
¡¡¡¡SQL ServerµÄÐÔÄÜÖ÷Ҫȡ¾öÓÚ´ÅÅÌI/OЧÂÊ£¬Ìá¸ßI/OЧÂÊijÖÖ³ÌÐòÉϾÍÒâζ×ÅÌá¸ßÐÔÄÜ¡£SQL Server 2008ÌṩÁËÊý¾ÝѹËõ¹¦ÄÜÀ´Ìá¸ß´ÅÅÌI/O¡£
¡¡¡¡Êý¾ÝѹËõÒâζ׿õСÊý¾ÝµÄÓдÅÅÌÕ¼ÓÃÁ¿£¬ËùÒÔÊý¾ÝѹËõ¿ÉÒÔÓÃÔÚ±í£¬¾Û¼¯Ë÷Òý£¬·Ç¾Û¼¯Ë÷Òý£¬ÊÓͼË÷Òý»òÊÇ·ÖÇø±í£¬·ÖÇøË÷ÒýÉÏ¡£
¡¡¡¡Êý¾ÝѹËõ¿ÉÒÔÔÚÁ½¸ö¼¶±ðÉÏʵÏÖ£ºÐ춱ðºÍÒ³¼¶±ð¡£Ò³¼¶±ðѹËõ°üÀ¨Ð춱ðѹËõ,RAID5¡£±íºÍË÷ÒýÔÚ´´½¨µÄͬʱ¾Í¿ÉÒÔѹËõ£¬Ò²¿ÉÒÔʹÓÃAlter Table Rebuild With »òÊÇ Alter Index Rebuild WithÓ﷨ѹËõÒÑ´æÔÚ±í»òÊÇË÷Òý¡£µ±¶Ñ(Heap)ÉϵÄѹËõ״̬¸Ä±äʱ£¬ËùÓеķǾۼ¯Ë÷ÒýÒ²»áÖؽ¨¡£
¡¡¡¡ÏÂÃæÈÃÎÒÃÇ¿´¿´Ñ¹Ëõ¹ý³Ìµ½µ×¶¼×öÁËЩʲô¡£
¡¡¡¡ÐÐѹËõ£º
¡¡¡¡1.¼õÉÙÔªÊý¾ÝÍ·¼Ç¼Êý¾Ý¡£
¡¡¡¡2.ËùÓеÄÊýÖµÀàÐÍ(integer,decimal,float)»ò»ùÓÚÊýÖµÀàÐ͵ÄÀàÐͶ¼»á±»Ñ¹Ëõ(datetime,money)¡£±ÈÈ磬100±»´æÔÚÒ»¸öintÐÍ×Ö¶ÎÖУ¬Õ¼4룬µ«ÊÇ´Ó0~255Ö»ÐèÒª1λ£¬Ñ¹Ëõºó£¬¾Í½ÚÊ¡ÁË3byte¿Õ¼ä¡£
¡¡¡¡3.CharºÍNChar¶¼±»´æ·ÅÓڿɱ䳤¶ÈµÄÀàÐÍÖС£ÔÒòͬÉÏ¡£±ÈÈ磬CSDN±»´æÔÚChar(10)ÖУ¬µ«ÊÇËüÖ»ÐèÒªChar(4)¿Õ¼ä£¬ËùÒÔѹËõºó¾ÍÊÍ·ÅÁËChar(6)¸ö¿Õ¼ä¡£
¡¡¡¡4.ËùÓÐÀàÐ͵ÄNULLºÍ0¶¼²»Õ¼×Ö½ÚÁË¡£
¡¡¡¡Ò³Ñ¹Ëõ£º
¡¡¡¡1.½øÐÐÐÐѹËõ¡£
¡¡¡¡2.Ç°±êѹËõ£ºÃ¿Ò»Ò³ÖеÄËùÓÐÁУ¬ÔÚÐбêÍ·ÏÂÃ棬ÿÐж¼´æ´¢×ÅÒ»¸öÐж¨ÒåÖµ£¬Ñ¹Ëõºó£¬ËùÓÐÐеĶ¨ÒåÖµ¶¼±»Ìæ»»³ÉÐÐÍ·ÖµµÄÒýÓá£
¡¡¡¡3.×ÖµäѹËõ£º×ÖµäѹËõºÍÇ°±êѹËõÀàËÆ¡£Ç°±êѹËõÖУ¬Ò»¸öÓëÆäËûÆÕֵͨ²»Í¬µÄÖµ±»¶¨Ò嵽ÿһÁÐÉÏ¡£µ«ÊÇ×ÖµäѹËõÖУ¬Ã¿Ò»Ò³ÖÐËùÓÐÁеÄÆÕֵͨ±»´æÔÚÏÂÒ»ÐеÄÐÐÍ·Ç°Ã档Ȼºó£¬ÕâЩֵ±»Ìæ»»³ÉÐÂÐеÄÒýÓÃÖµ¡£
¡¡¡¡ÏÂÃæÎÒÃÇÀ´¿´Ò»¸öÀý×Ó:
¡¡¡¡USEtempdb GOCREATETABLETestCompression (col1 INT, col2 CHAR(50)) GOINSERTINTOTestCompression VALUES(10, 'compression testing') GO5000--Original EXEC sp_spaceused TestCompression GO -- DATA_COMPRESSION = ROW ALTER TABLE TestCompression REBUILD WITH (DATA_COMPRESSION = ROW);
Ïà¹ØÎĵµ£º
ÔÚÐÔÄÜÉÏ£¬mysqlÊÇÏ൱³öÉ«µÄ£¬×ÀÃæ¸ñʽmyisamÊý¾Ý¿âÓë´ÅÅ̷dz£µØ¼æÈݶø²»Õ¼Óùý¶àµÄcpuºÍÄڴ棬mysqlÄÚ²¿ºÜ¶àʱºò¶¼Ê¹ÓÃ64λÕûÊý´¦Àí¡£yahoo¾ÍʹÓÃmysqlºǫ́Êý¾Ý¿â¡£
µ«mysqlȱÉÙһЩ¸½¼Ó¹¦ÄÜ£¬Ã»ÓÐSqlServerÈ«Ãæ¡£
sqlserverÎȶ¨ÐÍÇ¿£¬µ«±ØÐëÔö¼Ó¶îÍ⸴ÔÓ²Ù×÷£¬´ÅÅÌ´æ´¢£¬ÄÚ´æËðºÄµÈ£¬¶ÔÓ²¼þÈí¼þÒªÇ󶼺ܸߡ£
ÕâÁ½¸öÊý ......
ÔÚSQL¿ç±í×éºÏ²éѯ´æÔÚЧÂÊÎÊÌ⣬¾ÙÀý±ÈÈç
delete from media_source where movie_id in ( select media_id from media where type=2 ) and origin = 3;
ºÍ
delete from media_source where origin = 3 and movie_id in ( select media_id from media where type=2 );
µÄЧÂÊÊDz»Ò»ÑùµÄ¡£
Èôorigin=3µÄÇé¿öÏÂmedia_so ......
ÔÚSQLÓï¾äÓÅ»¯¹ý³ÌÖУ¬ÎÒÃǾ³£»áÓõ½hint,ÏÖ×ܽáÒ»ÏÂÔÚSQLÓÅ»¯¹ý³ÌÖг£¼ûOracle HINTµÄÓ÷¨£º
1. /*+ALL_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ¡Ôñ»ùÓÚ¿ªÏúµÄÓÅ»¯·½·¨,²¢»ñµÃ×î¼ÑÍÌÍÂÁ¿,ʹ×ÊÔ´ÏûºÄ×îС»¯.
ÀýÈç:
SELECT /*+ALL+_ROWS*/ EMP_NO,EMP_NAM,DAT_IN from BSEMPMS WHERE EMP_NO='SCOTT';
2. /*+FIRST_ROWS*/
±íÃ÷¶ÔÓï¾ä¿éÑ ......
SMOÊÇSQL Mangagement ObjectsµÄ¼ò³Æ.ÓëÖ®Ïà¶ÔÓ¦µÄÊÇADO.Net¡£
²»¹ý²»Í¬µÄµØ·½ÊÇADO.NetÊÇÓÃÓÚÊý¾Ý·ÃÎʵÄ,¶øSMOÊÇÓÃÓÚÉè¼ÆµÄ,ËäÈ»SMOÄܹ»ÔÙ·þÎñÆ÷ÉÏÖ´ÐÐÈÎÒâµÄSQLÓï¾ä.
ÁíÍâÒ»¸ö²»Í¬µÄµØ·½ÊÇADO.Net¿ÉÒÔ·ÃÎʼÆËã»úÖÐÈÎÒâÊý¾ÝÔ´,¶øSMO¶ÔÏóÊÇרÃÅÕë¶ÔSQL Server¶øÉè¼ÆµÄ.
ÔÚSMOÖÐ×îÖØÒªµÄÒ»¸öÀà¾ÍÊÇServer.ÆäËû´ó¶àÊý¶ÔÏó¶ ......
±¾ÎĹؼü´Ê£ºSQL 2008 SQL SQL Server SQL Server 2008
¶ÔÓÚ¼´½«ÔÚ2008Äê¡ÖØ·¢²¼µÄSQL Server 2008£¬Î¢ÈíÆÚÍûÊг¡²»½ö½öÊÇ°ÑËü×÷Ϊ¹ØϵÊý¾Ý¿âϵͳÀ´¿´´ý£¬Î¢Èí½«Æ䶨λΪһ¸öÆóÒµÊý¾Ýƽ̨£¬ËäÈ»¹ØϵÊý¾Ý¿âÒýÇæÈÔÈ»ÊÇSQL Server 2008µÄºËÐÄ£¬²»¹ýSQL Server 2008ËùÄÜÌṩµÄ·þÎñ¹ã¶È½«Ô¶³¬¹ý¼òµ¥µÄ¹ØϵÊý¾ ......