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

sqlÓÅ»¯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×Ô¶¯ÆÀ¹ÀÑ¡ÔñµÄ¡£µ


Ïà¹ØÎĵµ£º

ÓÃÒ»¸öSQLÓï¾äʵÏÖ²åÈë¶àÐÐÊý¾ÝµÄ¹¦ÄÜ

insert into A ±í select * from B ±í;
ÔÚoracleÖУ¬Ã¿¸öÓû§Ö»ÄܲÙ×÷×Ô¼ºµÄ±í£¬Òª²Ù×÷ÆäËûÓû§µÄ±íÊÇÐèÒªÆäËûÓû§¸³È¨Ï޵ġ£
grant ȨÏÞ on table to user;
   eg:grant select on table to newuser;
ÈôÒª½øÐÐÁ¬½Ó¾ÍÒªÊÚÓè(resource connect Á½¸ö½ÇÉ«) ......

SQL²éѯÓï¾ä¸´Ï°Ìâ

н¨Ñ§Éú-¿Î³ÌÊý¾Ý¿âµÄÈý¸ö±í:
ѧÉú±í:Student(Sno,Sname,Ssex,Sage,Sdept) SnoΪÖ÷Âë;
¿Î³Ì±í:Course(Cno,Cname,Cpno,Credeit) CnoΪÖ÷Âë;
ѧÉúÑ¡ÐÞ±í:SC(Sno,Cno,Grade) Sno,Cno,ΪÖ÷Âë;
Student
ѧºÅ
SnoÐÕÃû
SnameÐÔ±ð
SsexÄêÁä
SageËùÔÚϵ
Sdept
95001ÀîÓÂÄÐ20CS
95002Áõ³¿Å®19IS
95003ÍõÃôÅ®18MA
95004 ......

¸ßЧSQL²éѯ֮Ë÷Òý£¨II£©

ÉÏ»ØÎÒÃÇ˵µ½ÆÀ¹ÀÒ»ÌõÓï¾äÖ´ÐÐЧÂÊÖ÷Òª¿´Âß¼­ IO £¨É¶ÊÇÂß¼­ IO £¬É¶ÊÇÎïÀí IO ¼ûÁª»úÎĵµ£©£¬Õâ´ÎÎÒÃǼÌÐø¡£
ÎÒÃÇÏÈ˵˵£¬·µ»Ø¶àÐнá¹ûʱ£¬ÎªÊ²Ã´ SQLServer ÓÐʱ»áÑ¡Ôñ index seek £¬ÓÐʱ»áÑ¡Ôñ index scan ¡£
ÒÔ nonclustered index ΪÀý˵Ã÷¡£
ÏñËùÓеÄË÷Òý B Ê÷Ò»Ñù£¬·Ç¾Û¼¯Ë÷ÒýÊ÷Ò²°üÀ¨ÍêÈ«ÓÉË÷ÒýÊý¾Ý×é³ÉµÄ¸ù½ ......

SQL Server 2005 ÖеķÖÇø±íºÍË÷Òý(1)


¹ØÓÚ±¾Îı¾ÎÄËùÃè»æµÄ¹¦Äܺͼƻ®ÊÇÏÂÒ»°æ±¾ SQL Server µÄ¿ª·¢·½Ïò¡£ËüÃDz¢·Ç±¾²úÆ·µÄ˵Ã÷Ê飬ÈçÓиü¸Ä£¬Ë¡²»ÁíÐÐ֪ͨ¡£¶ÔÓÚ×îÖÕ²úÆ·ÊÇ·ñ¾ßÓÐÕâЩ¹¦Äܲ»×öÈκÎÃ÷ʾ»ò°µÊ¾µÄ±£Ö¤¡£¶ÔÓÚijЩ¹¦ÄÜ£¬±¾ÎļÙÉè¶ÁÕßÊìϤ SQL Server 2000 ¹¦ÄܺͷþÎñ¡£Óйر³¾°ÐÅÏ¢£¬Çë·ÃÎÊSQL Server ÍøÕ¾»ò SQL Server 2000 ×ÊÔ´¹¤¾ß°ü¡£Õâ²¢²»Ê ......

Oracle SqlÓÅ»¯±Ê¼Ç(Ò»)


»ù±¾µÄSql±àдעÒâÊÂÏî
¾¡Á¿ÉÙÓÃIN²Ù×÷·û£¬»ù±¾ÉÏËùÓеÄIN²Ù×÷·û¶¼¿ÉÒÔÓÃEXISTS´úÌæ¡£
²»ÓÃNOT IN²Ù×÷·û£¬¿ÉÒÔÓÃNOT EXISTS»òÕßÍâÁ¬½Ó+Ìæ´ú¡£
OracleÔÚÖ´ÐÐIN×Ó²éѯʱ£¬Ê×ÏÈÖ´ÐÐ×Ó²éѯ£¬½«²éѯ½á¹û·ÅÈëÁÙʱ±íÔÙÖ´ÐÐÖ÷²éѯ¡£¶øEXISTÔòÊÇÊ×Ïȼì²éÖ÷²éѯ£¬È»ºóÔËÐÐ×Ó²éѯֱµ½ÕÒµ½µÚÒ»¸öÆ¥ÅäÏî¡£NOT EXISTS±ÈNOT INЧÂÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ