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

SQL SERVERÐÔÄÜÓÅ»¯ TempdbÏà¹ØÎÊÌâ

TEMPDB²»Ö§³Ö×Ô¶¯Ñ¹Ëõ£¬ÇÒËüµÄÊý¾Ý¿âºÍÎļþѹËõÄÜÁ¦ÊÇÓÐÏÞÖƵģ»
Èç²»µÃ²»Ñ¹ËõTEMPDBµÄ´óС£¬½¨ÒéʹÓÃÀëÏß¹¦ÄÜ£¬ÈçϲÙ×÷£º
1.Í£Ö¹SQL SERVER·þÎñ£»
2.ÕÒµ½sqlservr.exeÔÚ´ÅÅÌÖеÄλÖã»
3.ʹÓÃsqlservr.exeÊäÈëÃüÁîsqlservr -c -f,ÕâÑùÆô¶¯SQL SERVERʱ£¬TEMPDBµÄ´óСÄܹ»±£³Ö×îС£»
4.ʹÓÃTSQLÃüÁALTER DATABASE TEMPDB MODIFY FILE£¨£©£¬ÕâÑù¾Í¿ÉÒԸıäTEMPDBµÄ´óС£»
5.ÖØÆôSQL SERVER·þÎñ£»
TEMPDB¿Õ¼äÓÐÈýÖÖ¶ÔÏó--Óû§¶ÔÏó¡¢ÄÚ²¿¶ÔÏóÒÔ¼°°æ±¾´æ´¢¶ÔÏó£»
Óû§¶ÔÏó£º
Óû§¶¨ÒåµÄ±¾µØÁÙʱ±íÖÐÁÙʱʹÓõĶÔÏó£»
Àý£ºselect * from sys.all_objects
ÄÚ²¿¶ÔÏó£º
·········10········20········30········40········50········60········70········80········90········100·······110·······120·······130·······140·······150
declare @i int 
set @i = 0  
create table #myTempTable (keycolumn int, mybigCharColumn char (1000) )  
while (@i < 1000000)  
begin  
insert into #myTempTable values(@i,'x' )  
set @i = @i + 1  
end  
select * from #myTempTable  
order by keycolumn 
declare @i int
set @i = 0
create table #myTempTable (keycolumn int, mybigCharColumn char (1000) )
while (@i < 100000


Ïà¹ØÎĵµ£º

oracle sql tuning

alert index mem_ct monitoring usage;
desc v$object_usage;
set linesize 190
select * from v$object_usage;
SQL>SET AUTOTRACE ON;
¡¡¡¡*autotrace¹¦ÄÜÖ»ÄÜÔÚSQL*PLUSÀïʹÓÃ
¡¡¡¡ÆäËûһЩʹÓ÷½·¨£º
¡¡¡¡2.2.1¡¢ÔÚSQLPLUSÖеõ½Óï¾ä×ܵÄÖ´ÐÐʱ¼ä
¡¡¡¡SQL> set timing on;
2.2.2¡¢Ö»ÏÔʾִÐмƻ®--(»áÍ¬Ê ......

SQL ServerÈÕÆÚ²Ù×÷

1¡¢²éѯÁ½¸öʱ¼äÖ®¼ä
select * from [tablename] where date between \'value1\' and \'value2\'
 
2¡¢ÏÔʾ×îºó»Ø¸´Ê±¼ä
select a.title,a.username,b.adddate from table a,(select max(adddate) adddate from table where table.title=a.title) b
 
3¡¢Èճ̰²ÅÅÌáÇ°5·ÖÖÓÌáÐÑ
select * from Èճ̰²ÅÅ w ......

SQLµÄ·ÖÒ³²éѯ

·ÖÒ³²éѯµÄÔ­Àí£º
 Õâ¸öÖ»ÄÜÓÃÔÙSql2005¼°ÒÔÉϵİ汾
DECLARE @pagenum AS INT, @pagesize AS INT  
SET @pagenum = 2   
SET @pagesize = 3   
SELECT *   
from (SELECT ROW_NUMBER()&n ......

SQL ¶àÐÐÖµºÏ²¢ÎªÒ»¸öÖµ

·½·¨(1)
SELECT stuff((select ','+ltrim(ColumnName) from #A for xml path('')
),1,1,'')
/*
102,103,104,105
*/
·½·¨(2)
DECLARE @s NVARCHAR(1000)='';
SELECT @s+=ColumnName+','  from #A;
SELECT @s; ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ