SQL Server 2008ÐÐÊý¾ÝºÍÒ³Êý¾ÝѹËõ½âÃÜ
SQL ServerµÄÐÔÄÜÖ÷Ҫȡ¾öÓÚ´ÅÅÌI/OЧÂÊ£¬Ìá¸ßI/OЧÂÊijÖÖ³ÌÐòÉϾÍÒâζ×ÅÌá¸ßÐÔÄÜ¡£SQL Server 2008ÌṩÁËÊý¾ÝѹËõ¹¦ÄÜÀ´Ìá¸ß´ÅÅÌI/O¡£
Êý¾ÝѹËõÒâζ׿õСÊý¾ÝµÄÓдÅÅÌÕ¼ÓÃÁ¿£¬ËùÒÔÊý¾ÝѹËõ¿ÉÒÔÓÃÔÚ±í£¬¾Û¼¯Ë÷Òý£¬·Ç¾Û¼¯Ë÷Òý£¬ÊÓͼË÷Òý»òÊÇ·ÖÇø±í£¬·ÖÇøË÷ÒýÉÏ¡£
Êý¾ÝѹËõ¿ÉÒÔÔÚÁ½¸ö¼¶±ðÉÏʵÏÖ£ºÐ춱ðºÍÒ³¼¶±ð¡£Ò³¼¶±ðѹËõ°üÀ¨Ð춱ðѹËõ¡£±íºÍË÷ÒýÔÚ´´½¨µÄͬʱ¾Í¿ÉÒÔѹËõ£¬Ò²¿ÉÒÔʹÓÃ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.×ÖµäѹËõ£º×ÖµäѹËõºÍÇ°±êѹËõÀàËÆ¡£Ç°±êѹËõÖУ¬Ò»¸öÓëÆäËûÆÕֵͨ²»Í¬µÄÖµ±»¶¨Ò嵽ÿһÁÐÉÏ¡£µ«ÊÇ×ÖµäѹËõÖУ¬Ã¿Ò»Ò³ÖÐËùÓÐÁеÄÆÕֵͨ±»´æÔÚÏÂÒ»ÐеÄÐÐÍ·Ç°Ã档Ȼºó£¬ÕâЩֵ±»Ìæ»»³ÉÐÂÐеÄÒýÓÃÖµ¡£
ÏÂÃæÎÒÃÇÀ´¿´Ò»¸öÀý×Ó:
USE tempdb
GO
CREATE TABLE TestCompression (col1 INT, col2 CHAR(50))
GO
INSERT INTO TestCompression VALUES (10, 'compression testing')
GO 5000
-- Original
EXEC sp_spaceused TestCompression
GO
-- DATA_COMPRESSION = ROW
ALTER TABLE TestCompression
REBUILD WITH (DATA_COMPRESSION = ROW);
GO
EXEC sp_spaceused TestCompression
GO
-- DATA_COMPRESSION = PAGE
ALTER TABLE TestCompression
REBUILD WITH (DATA_COMPRESSION = PAGE);
GO
EXEC sp_spaceused TestCompression
GO
-- DATA_COMPRESSION = NONE
ALTER TABLE TestCompression
REBUILD WITH (DATA_COMPRESSION = NONE);
GO
EXEC sp_spaceused TestCompression
GO
Ïà¹ØÎĵµ£º
(1)¶þ½øÖÆÊý¾ÝÀàÐÍ
¡¡¡¡¶þ½øÖÆÊý¾Ý°üÀ¨ Binary¡¢Varbinary ºÍ Image
¡¡¡¡Binary
Êý¾ÝÀàÐͼȿÉÒÔÊǹ̶¨³¤¶ÈµÄ(Binary),Ò²¿ÉÒÔÊDZ䳤¶ÈµÄ¡£
¡¡¡¡Binary[(n)] ÊÇ n λ¹Ì¶¨µÄ¶þ½øÖÆÊý¾Ý¡£ÆäÖУ¬n
µÄÈ¡Öµ·¶Î§ÊÇ´Ó 1 µ½ 8000¡£Æä´æ´¢ñ¿µÄ´óСÊÇ n + 4 ¸ö×Ö½Ú¡£
¡¡¡¡Varbinary[(n)] ÊÇ n
λ±ä³¤¶ÈµÄ¶þ½øÖÆÊý¾Ý¡£ÆäÖУ ......
ORDER BY ×Ӿ䰴һÁлò¶àÁУ¨×î¶à 8,060 ¸ö×Ö½Ú£©¶Ô²éѯ½á¹û½øÐÐÅÅÐò¡£ÓÐ¹Ø ORDER BY ×Ó¾ä×î´ó´óСµÄÏêϸÐÅÏ¢£¬Çë²ÎÔÄ ORDER BY ×Ó¾ä (Transact-SQL)¡£
Microsoft SQL Server 2005 ÔÊÐíÔÚ from ×Ó¾äÖÐÖ¸¶¨¶Ô SELECT ÁбíÖÐδָ¶¨µÄ±íÖеÄÁнøÐÐÅÅÐò¡£ORDE ......
ÔÚSQL ServerµÄÐÔÄܵ÷ÓÅÖУ¬ÓÐÒ»¸ö²»¿É±ÈÄâµÄÎÊÌ⣺ÄǾÍÊÇÈçºÎÔÚÒ»¶ÎÐèÒª³¤Ê±¼äµÄ´úÂë»ò±»Æµ·±µ÷ÓõĴúÂëÖд¦ÀíÁÙʱÊý¾Ý¼¯?±í±äÁ¿ºÍÁÙʱ±íÊÇÁ½ÖÖÑ¡Ôñ¡£
¡¡¡¡ÔÚSQL ServerµÄÐÔÄܵ÷ÓÅÖУ¬ÓÐÒ»¸ö²»¿É±ÈÄâµÄÎÊÌ⣺ÄǾÍÊÇÈçºÎÔÚÒ»¶ÎÐèÒª³¤Ê±¼äµÄ´úÂë»ò±»Æµ·±µ÷ÓõĴúÂëÖд¦ÀíÁÙʱÊý¾Ý¼¯?±í±äÁ¿ºÍÁÙʱ±íÊÇÁ½ÖÖÑ¡Ôñ¡£¼ÇµÃÔÚ¸øÒ»¼Ò ......
XËø¼´ÊÇÎÒÃdz£ËµµÄÅÅËüËø£¬UËøºÜÉÙ¼û£¬Ö»ÔÚ¸üÐÂʱ»á³öÏÖ¡£UËøÆäʵÊÇXËøµÄÒ»ÖÖ£¬µ±Êý¾Ý¸üÐÂʱ£¬UËøÊ×Ïȼӵ½Òª¸üеÄÊý¾ÝÉÏ(¼´Ê¹Ä¿±êÉÏÃæÓÐSËø£¬UËø»¹ÊÇ¿ÉÒÔ¼ÓÉÏ)£¬µÈÄ¿±ê¿ÉÒÔ±»¸üÐÂʱ£¬UËø¼´×ª±äΪXËø¡£ ÈçÐèתÔØ£¬Çë×¢Ã÷±¾ÎÄÔ´´×ÔCSDN TJVictorרÀ¸£ºhttp://blog.csdn.net/tjvictor ......
Ç°Ìá,MS SQLµÄͨÅä·ûº¬Ò壺
ÐòºÅ
ͨÅä·û
º¬Òå
ʾÀý
1
%
°üº¬Áã¸ö»ò¶à¸ö×Ö·ûµÄÈÎÒâ×Ö·û´®¡£
WHERE title LIKE '%computer%' ½«²éÕÒÔÚÊéÃûÖÐÈÎÒâλÖðüº¬µ¥´Ê"computer" µÄËùÓÐÊéÃû¡£
2
_
Èκε¥¸ö×Ö·û¡£
WHERE au_fname LIKE '_ean' ½«²éÕÒÒÔ ean ½áβµÄËùÓÐ 4 ¸ö×ÖĸµÄÃû×Ö£¨Dean¡¢Sean µÈ£©¡£
3
[ ] ......