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

´óÊý¾ÝÁ¿Ï¿ìËÙ»ñÈ¡ SQL Server Êý¾Ý¿â±í¼Ç¼ÊýµÄ·½·¨

ÔÚÊý¾Ý¿âÓ¦ÓõÄÉè¼ÆÖУ¬ÎÒÃÇÍùÍù»áÐèÒª»ñȡijЩ±íµÄ¼Ç¼×ÜÊý£¬ÓÃÓÚÅжϱíµÄ¼Ç¼×ÜÊýÊÇ·ñ¹ý´ó£¬ÊÇ·ñÐèÒª±¸·ÝÊý¾ÝµÈ¡£ÎÒÃÇͨ³£µÄ×ö·¨ÊÇ£ºselect count(*) as c from tableA ¡£È»¶ø¶ÔÓڼǼÊý¾Þ´óµÄ±í£¬ÉÏÊö×ö·¨½«»á·Ç³£ºÄʱ¡£ÔÚDELL 4400 ·þÎñÆ÷ÉÏ×öÊÔÑ飬MS Sqlserver 2000 Êý¾Ý¿â¶ÔÓÚ100Íò¼Ç¼µÄ¼òµ¥Êý¾Ý±íÖ´ÐÐÉÏÊöÓï¾ä£¬Ê±¼äÔÚ1·ÖÖÓÒÔÉÏ¡£Èç¹ûÔÚ±íµÄij¸ö×Ö¶ÎÉÏ×ö¾Û´ØË÷Òý£¬µÚÒ»´ÎÖ´ÐиÃÓï¾äµÄʱ¼äºÍûÓÐË÷ÒýµÄʱ¼ä²î²»¶à£¬Ö®ºóÖ´ÐÐÉÏÊöÓï¾ä£¬ËٶȺܿ죬ÔÚ1ÃëÖÐÒÔÄÚ£¬µ«µ±±íµÄ¼Ç¼Êý·¢Éú½Ï´ó±ä»¯ºó£¬ÔÙÖ´ÐиÃÓï¾äÓֻᾭÀúÒ»´ÎºÄʱµÄ¹ý³Ì¡£¶øÇÒ²»ÊÇÿ¸ö±í¶¼ÊʺÏ×ö¾Û´ØË÷ÒýµÄ£¬¶ÔÓÚÊýÁ¿¾Þ´óµÄ±í£¬Èç¹ûÐèÒª¾­³£Ôöɾ²Ù×÷£¬½¨¾Û´ØË÷ÒýÊÇÒ»¸öºÜ²»Ã÷ÖǵÄ×ö·¨£¬½«»á¼«´óµÄÓ°ÏìÔöɾµÄËٶȡ£ÄÇôÓÐûÓÐÒ»¸ö±È½Ï¼òµ¥µÄ·½·¨¿ìËÙ»ñÈ¡±íµÄ¼Ç¼×ÜÊýÄØ£¿´ð°¸ÊÇÓеġ£
ÔÚMS SQL Êý¾Ý¿âÖÐÿ¸ö±í¶¼ÔÚsysindexes ϵͳ±íÖÐÓµÓÐÖÁÉÙÒ»Ìõ¼Ç¼£¬¸Ã¼Ç¼ÖеÄrows ×ֶλᶨʱ¼Ç¼±íµÄ¼Ç¼×ÜÊý¡£
ÏÂÃæÊÇsysindexes ±íµÄÏà¹Ø¼Ç¼µÄº¬Ò壺
ÁÐÃû Êý¾ÝÀàÐÍ ÃèÊö
id int ±íID(Èç¹û indid = 0 »ò255)¡£·ñÔòΪË÷ÒýËùÊô±íµÄID
Indid smallint Ë÷ÒýID£º
0£½±í
1£½¾Û´ØË÷Òý
>1£½·Ç¾Û´ØË÷Òý
255£½¾ßÓÐtext»òimageÊý¾ÝµÄ±íÌõÄ¿¡£
rows int »ùÓÚindid=0 ºÍ indid=1µØÊý¾Ý¼¶ÐÐÊý£¬¸ÃÖµ¶ÔÓÚindid>1ÖØ ¸´¡£Èç¹ûindid=255£¬rowsÉèÖÃΪ0¡£
µ±±íûÓо۴ØË÷Òýʱ£¬Indid = 0 ·ñÔòΪ 1¡£
ÄÇôÏÖÔÚ´ó¼ÒÓ¦¸ÃÖªµÀÈçºÎ»ñÈ¡±íµÄ¼Ç¼×ÜÊýÁË£¬Ö»ÐèÖ´ÐÐÈçÏÂÓï¾ä£º
select rows from sysindexes where id = object_id('tablename') and indid in (0,1)
¸Ã·½·¨»ñÈ¡±íµÄ¼Ç¼×ÜÊýµÄËٶȷdz£¿ì£¬ÔÚºÁÃ뼶¾Í¿ÉÒÔÍê³É£¬Ïà±Èselect count(*) Òª¿ìÉÏÊýÍò±¶£¬µ«ÊÇ´ó¼ÒÔÚÔËÓø÷½·¨ÊÇÒ»¶¨ÒªÖ÷Òª£¬¸Ã·½·¨µÃµ½µÄ±íµÄ×ܼǼÊý²»ÊÇÒ»¸ö¾«È·Öµ£¬Ô­ÒòÊÇMS SQL ²¢²»ÊÇʵʱ¸üиÃ×ֶεÄÖµ£¬¶øÊǶ¨Ê±¸üУ¬µ±´Óʵ¼ùÀ´¿´¸ÃÖµºÍ¾«È·ÖµÒ»°ãÎó²î²»´ó£¬Èç¹ûÄãÏ£Íû¿ìËٵĴÖÂÔ¹ÀËã±íµÄ´óС£¬½¨ÒéÄã²ÉÓø÷½·¨¡£Èç¹ûÄãÏ£ÍûµÃµ½¾«È·Öµ£¬ÄÇôÇëÔÚÖ´ÐÐÉÏÊöÓï¾äÇ°Ö´ÐÐDBCC UpdateUSAGE(DatabaseName,[TABLENAME]) WITH ROW_COUNTS Ç¿ÖƸüиÃ×ֶεÄÖµ£¬µ«ÕâÑùµÚÒ»´Î¸üÐÂʱ»áºÄ·Ñ´óÁ¿µÄʱ¼ä£¬ÕâÑù×öµÄЧ¹ûºÍ½¨Óо۴ØË÷ÒýµÄ±í select count (*) Ч¹ûÏà²î²»´ó£¬ËùÒÔÈç¹ûÄãÏ£ÍûÏà¶Ô¿ìËٵصõ½¾«È·µÄ±íµÄ¼Ç¼×ÜÊý£¬ÄÇôÄãÓÐÁ½ÖÖÑ¡Ôñ£¬½¨¾Û´ØË÷Òý»òÕßÏÈDBCC ÔÙʹÓÃÉÏÊö·½·¨


Ïà¹ØÎĵµ£º

sql¶à±íÁ¬½Ó²éѯ

inner join,full outer join,left join,right jion
ÄÚ²¿Á¬½Ó inner join Á½±í¶¼Âú×ãµÄ×éºÏ
full outer È«Á¬ Á½±íÏàͬµÄ×éºÏÔÚÒ»Æð£¬A±íÓУ¬B±íûÓеÄÊý¾Ý£¨ÏÔʾΪnull£©,ͬÑùB±íÓÐ
A±íûÓеÄÏÔʾΪ(null)
A±í left join  B±í ×óÁ¬,ÒÔA±íΪ»ù´¡£¬A±íµÄÈ«²¿Êý¾Ý£¬B±íÓеÄ×éºÏ¡£Ã»ÓеÄΪnull
A±í right join B±í ÓÒÁ ......

SQL ¶¯Ì¬ÅÅÐòµÄ·½·¨

ÔÚ¹«¹²ÐÂÎÅ×éÖУ¬Ò»¸ö¾­³£³öÏÖµÄÎÊÌâÊÇ“ÔõÑù²ÅÄܸù¾Ý´«µÝ¸ø´æ´¢¹ý³ÌµÄ²ÎÊý·µ»ØÒ»¸öÅÅÐòµÄÊä³ö£¿”¡£ÔÚһЩ¸ßˮƽר¼ÒµÄ°ïÖú֮ϣ¬ÎÒÕûÀí³öÁËÕâ¸öÎÊÌâµÄ¼¸ÖÖ½â¾ö·½°¸¡£
Ò»¡¢ÓÃIF...ELSEÖ´ÐÐÔ¤ÏȱàдºÃµÄ²éѯ
¡¡¡¡¶ÔÓÚ´ó¶àÊýÈËÀ´Ëµ£¬Ê×ÏÈÏëµ½µÄ×ö·¨Ò²ÐíÊÇ£ºÍ¨¹ýIF...ELSEÓï¾ä£¬Ö´Ðм¸¸öÔ¤ÏȱàдºÃµÄ²éѯÖеÄÒ» ......

SQL Access Advisor

Oracle Êý¾Ý¿â 10g ÌṩÁË´óÁ¿°ïÖú³ÌÐò£¨»ò“¹ËÎʳÌÐò”£©£¬¿É°ïÖúÄú¾ö¶¨×î¼Ñ²Ù×÷Á÷³Ì¡£ÆäÖÐÒ»¸öʾÀýÊÇ SQL Tuning Advisor£¬Ëü¿ÉÒÔÌṩÓйزéѯµ÷ÕûÒÔ¼°ÔÚÁ÷³ÌÖÐÑÓ³¤Õû¸öÓÅ»¯¹ý³ÌµÄ½¨Òé¡£
µ«Ç뿼ÂÇÒÔϵ÷Õû°¸Àý£º¼ÙÉèÒ»¸öË÷ÒýȷʵÓÐÖúÓÚij¸ö²éѯ£¬µ«¸Ã²éѯִֻÐÐÒ»´Î¡£ÕâÑù£¬¼´Ê¹¸Ã²éѯ¿ÉÒÔµÃÒæÓÚ´ËË÷Òý£¬µ«´´ ......

·ÀÖ¹sql×¢È룬¿çÕ¾½Å±¾

sql×¢Èë·ÀÖ¹µÄ·½Ê½£º
1.×î¸ù±¾µÄ°ì·¨¾ÍÊÇʹÓÃÔ¤±àÒëµÄ·½Ê½½øÐÐÊý¾Ý¿â²Ù×÷¡£¼´Ê±Ê¹Ó㿵ķ½Ê½¡£
2.ʹÓùýÂËÀà¡£
·ÀÖ¹¿çÕ¾½Å±¾µÄ·½Ê½£º
1.ÔÚÊý¾Ý¼Èë½×¶Î½øÐйýÂË£¬µ«ÊÇÕâÖÖ·½Ê½»áÊǶªÊ§Ò»Ð©Êý¾Ý¡£
2. ÔÚÊý¾Ýչʾ½×¶Î¡£Ê¹ÓñêÇ©°üº¬£¬innerhtml µÄ·½Ê½¡£ ......

SQL SERVER 2005 Êý¾Ý¿â״̬Ϊ¡°¿ÉÒÉ¡±µÄ½â¾ö·½·¨

--MyDBΪÐÞ¸´µÄÊý¾ÝÃû
USE MASTER
GO
SP_CONFIGURE 'ALLOW UPDATES',1 RECONFIGURE WITH OVERRIDE
GO
ALTER DATABASE MyDB SET EMERGENCY
GO
sp_dboption 'MyDB', 'single user', 'true'
GO
DBCC CHECKDB('MyDB','REPAIR_ALLOW_DATA_LOSS')
GO
ALTER DATABASE MyDB SET ONLINE
GO
sp_configure 'allow updates ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ