sql serverÓÅ»¯50·¨
²éѯËÙ¶ÈÂýµÄÔÒòºÜ¶à£¬³£¼ûÈçϼ¸ÖÖ£º
1¡¢Ã»ÓÐË÷Òý»òÕßûÓÐÓõ½Ë÷Òý(ÕâÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
2¡¢I/OÍÌÍÂÁ¿Ð¡£¬ÐγÉÁËÆ¿¾±Ð§Ó¦¡£
3¡¢Ã»Óд´½¨¼ÆËãÁе¼Ö²éѯ²»ÓÅ»¯¡£
4¡¢ÄÚ´æ²»×ã
5¡¢ÍøÂçËÙ¶ÈÂý
6¡¢²éѯ³öµÄÊý¾ÝÁ¿¹ý´ó£¨¿ÉÒÔ²ÉÓöà´Î²éѯ£¬ÆäËûµÄ·½·¨½µµÍÊý¾ÝÁ¿£©
7¡¢Ëø»òÕßËÀËø(ÕâÒ²ÊDzéѯÂý×î³£¼ûµÄÎÊÌ⣬ÊdzÌÐòÉè¼ÆµÄȱÏÝ)
8¡¢sp_lock,sp_who,»î¶¯µÄÓû§²é¿´,ÔÒòÊǶÁд¾ºÕù×ÊÔ´¡£
9¡¢·µ»ØÁ˲»±ØÒªµÄÐкÍÁÐ
10¡¢²éѯÓï¾ä²»ºÃ£¬Ã»ÓÐÓÅ»¯
¿ÉÒÔͨ¹ýÈçÏ·½·¨À´ÓÅ»¯²éѯ :
1¡¢°ÑÊý¾Ý¡¢ÈÕÖ¾¡¢Ë÷Òý·Åµ½²»Í¬µÄI/OÉ豸ÉÏ£¬Ôö¼Ó¶ÁÈ¡Ëٶȣ¬ÒÔÇ°¿ÉÒÔ½«TempdbÓ¦·ÅÔÚRAID0ÉÏ£¬
SQL2000²»ÔÚÖ§³Ö¡£Êý¾ÝÁ¿£¨³ß´ç£©Ô½´ó£¬Ìá¸ßI/OÔ½ÖØÒª.
2¡¢×ÝÏò¡¢ºáÏò·Ö¸î±í£¬¼õÉÙ±íµÄ³ß´ç(sp_spaceuse)
3¡¢Éý¼¶Ó²¼þ
4¡¢¸ù¾Ý²éѯÌõ¼þ,½¨Á¢Ë÷Òý,ÓÅ»¯Ë÷Òý¡¢ÓÅ»¯·ÃÎÊ·½Ê½£¬ÏÞÖƽá¹û¼¯µÄÊý¾ÝÁ¿¡£×¢ÒâÌî³äÒò×ÓÒªÊʵ±£¨×î
ºÃÊÇʹÓÃĬÈÏÖµ0£©¡£Ë÷ÒýÓ¦¸Ã¾¡Á¿Ð¡£¬Ê¹ÓÃ×Ö½ÚÊýСµÄÁн¨Ë÷ÒýºÃ£¨²ÎÕÕË÷ÒýµÄ´´½¨£©,²»Òª¶ÔÓÐÏÞµÄ
¼¸¸öÖµµÄ×ֶν¨µ¥Ò»Ë÷ÒýÈçÐÔ±ð×Ö¶Î
5¡¢Ìá¸ßÍøËÙ;
6¡¢À©´ó·þÎñÆ÷µÄÄÚ´æ,Windows 2000ºÍSQL server 2000ÄÜÖ§³Ö4-8GµÄÄÚ´æ¡£ÅäÖÃÐéÄâÄڴ棺ÐéÄâÄÚ´æ´ó
СӦ»ùÓÚ¼ÆËã»úÉϲ¢·¢ÔËÐеķþÎñ½øÐÐÅäÖá£ÔËÐÐ Microsoft SQL Server? 2000 ʱ£¬¿É¿¼Âǽ«ÐéÄâÄÚ
´æ´óСÉèÖÃΪ¼ÆËã»úÖа²×°µÄÎïÀíÄÚ´æµÄ 1.5 ±¶¡£Èç¹ûÁíÍâ°²×°ÁËÈ«ÎļìË÷¹¦ÄÜ£¬²¢´òËãÔËÐÐ
Microsoft ËÑË÷·þÎñÒÔ±ãÖ´ÐÐÈ«ÎÄË÷ÒýºÍ²éѯ£¬¿É¿¼ÂÇ£º½«ÐéÄâÄÚ´æ´óСÅäÖÃΪÖÁÉÙÊǼÆËã»úÖа²×°µÄ
ÎïÀíÄÚ´æµÄ 3 ±¶¡£½« SQL Server max server memory ·þÎñÆ÷ÅäÖÃÑ¡ÏîÅäÖÃΪÎïÀíÄÚ´æµÄ 1.5 ±¶£¨Ðé
ÄâÄÚ´æ´óСÉèÖõÄÒ»°ë£©¡£
7¡¢Ôö¼Ó·þÎñÆ÷CPU¸öÊý;µ«ÊDZØÐëÃ÷°×²¢Ðд¦Àí´®Ðд¦Àí¸üÐèÒª×ÊÔ´ÀýÈçÄڴ档ʹÓò¢Ðл¹ÊÇ´®ÐгÌÊÇ
MsSQL×Ô¶¯ÆÀ¹ÀÑ¡ÔñµÄ¡£µ¥¸öÈÎÎñ·Ö½â³É¶à¸öÈÎÎñ£¬¾Í¿ÉÒÔÔÚ´¦ÀíÆ÷ÉÏÔËÐС£ÀýÈçµ¢¸é²éѯµÄÅÅÐò¡¢Á¬½Ó
¡¢É¨ÃèºÍGROUP BY×Ö¾äͬʱִÐУ¬SQL SERVER¸ù¾ÝϵͳµÄ¸ºÔØÇé¿ö¾ö¶¨×îÓŵIJ¢Ðеȼ¶£¬¸´ÔÓµÄÐèÒªÏû
ºÄ´óÁ¿µÄCPUµÄ²éѯ×îÊʺϲ¢Ðд¦Àí¡£µ«ÊǸüвÙ×÷UPDATE,INSERT£¬DELETE»¹²»Äܲ¢Ðд¦Àí¡£
8¡¢Èç¹ûÊÇʹÓÃlike½øÐвéѯµÄ»°£¬¼òµ¥µÄʹÓÃindexÊDz»Ðеģ¬µ«ÊÇÈ«ÎÄË÷Òý£¬ºÄ¿Õ¼ä¡£ like 'a%' ʹ
ÓÃË÷Òý like '%a' ²»Ê¹ÓÃË÷ÒýÓà like '%a%' ²éѯʱ£¬²éѯºÄʱºÍ×Ö¶ÎÖµ×ܳ¤¶È³ÉÕý±È,ËùÒÔ²»ÄÜÓÃ
CHARÀàÐÍ£¬¶øÊÇVARCHAR¡£¶ÔÓÚ×ֶεÄÖµºÜ³¤µÄ½¨È«ÎÄË÷Òý¡£
9¡¢DB Server ºÍAP
Ïà¹ØÎĵµ£º
Sql Server ÖÐÒ»¸ö·Ç³£Ç¿´óµÄÈÕÆÚ¸ñʽ»¯º¯Êý
:
Select CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
Select CONVERT(varchar(100), GETDATE(), 1): 05/16/06
Select CONVERT(varchar(100), GETDATE(), 2): 06.05.16
Select CONVERT(varchar(100), GETDATE(), 3): 16/05/06
Select CONVERT(varchar(100), ......
RowidµÄ¸ÅÄ
rowidÊÇÒ»¸öαÁУ¬¼ÈÈ»ÊÇαÁУ¬ÄÇôÕâ¸öÁоͲ»ÊÇÓû§¶¨Ò壬¶øÊÇϵͳ×Ô¼º¸ø¼ÓÉϵġ£¶Ôÿ¸ö±í¶¼ÓÐÒ»¸örowidµÄαÁУ¬µ«ÊDZíÖв¢²»ÎïÀí´æ´¢ROWIDÁеÄÖµ¡£²»¹ýÄã¿ÉÒÔÏñʹÓÃÆäËüÁÐÄÇÑùʹÓÃËü£¬µ«ÊDz»ÄÜɾ³ý¸ÄÁУ¬Ò²²»ÄܶԸÃÁеÄÖµ½øÐÐÐ޸ġ¢²åÈë¡£Ò»µ©Ò»ÐÐÊý¾Ý²åÈëÊý¾Ý¿â£¬ÔòrowidÔÚ¸ÃÐеÄÉúÃüÖÜÆÚÄÚÊÇΨһµÄ£¬¼´ ......
Êý¾Ý¿âËùÓÐÕß (DataBase Owner)
dbo ÊǾßÓÐÔÚÊý¾Ý¿âÖÐÖ´ÐÐËùÓлµÄ°µÊ¾ÐÔȨÏÞµÄÓû§¡£½«¹Ì¶¨·þÎñÆ÷½ÇÉ« sysadmin µÄÈκγÉÔ±¶¼Ó³É䵽ÿ¸öÊý¾Ý¿âÄÚ³ÆΪ dbo µÄÒ»¸öÌØÊâÓû§ÉÏ¡£ÁíÍ⣬Óɹ̶¨·þÎñÆ÷½ÇÉ« sysadmin µÄÈκγÉÔ±´´½¨µÄÈκζÔÏó¶¼×Ô¶¯ÊôÓÚ ......
bit£º0»ò1µÄÕûÐÍÊý×Ö
int£º´Ó-2^31(-2,147,483,648)µ½2^31(2,147,483,647)µÄÕûÐÍÊý×Ö
smallint£º´Ó-2^15(-32,768)µ½2^15(32,767)µÄÕûÐÍÊý×Ö
tinyint£º´Ó0µ½255µÄÕûÐÍÊý×Ö
decimal£º´Ó-10^38µ½10^38-1µÄ¶¨¾«¶ÈÓëÓÐЧλÊýµÄÊý×Ö
numeric£ºdecimalµÄͬÒå´Ê
money£º´Ó-2^63(-922,337,203,685,477.5808)µ½2^ ......
ÏîÄ¿ÖÕÓÚ½áÊøÁË£¬×ܽáµÄʱºòµ½ÁË... hehe :)
ÔÚÏîÄ¿ÖÐÎÒÃÇÓöµ½Á˺ܶàµÄÎÊÌ⣬±ê×¼SQLʹÓþÍÊÇÆäÖÐÒ»¸ö¡£ ÒòΪÎÒÃÇÔÚ×öBI packageµÄʱºò£¬Ò»¿ªÊ¼¶¼ÊÇ»ùÓÚMS SQL À´×öµÄ£¬ËùÒÔUniverseµÄÉè¼ÆÉÏҲûÓÐÌ«¶àµÄ¿¼ÂÇ¡£ µ±ºóÀ´ÀÏ´ó¸æËßÎÒÅ ......