2 碁煙 襴 #
企 れ螻 螳 碁煙り 焔 .
襷豺 碁煙 襷覯襯 蟆螻 觜訣 碁煙るゼ 螳譟. 覿覈 蠍一 焔 碁煙 覈 螳 れ襦 讌 . 襷 る 蠏瑚 覓語. れ 碁煙 譴 讌 碁煙れ企.
IDX_YEAR_MONTH_DAY
IDX_YEAR_MONTH_DAY_HOUR
讌 讌 企 伎 蠍 瑚朱襦 牛襦 蟆. 危エ覲伎 蟆 企. 谿願 襷 讌 る 碁煙るゼ 豢螳襦 襴 譯殊伎 . 貎朱Μ 企 覲伎 . 貎朱Μ 伎 譟一企蓋 蟆郁骸 企 貎朱Μ SP 錫 蟾讌襷 襦 . 蠏碁覩襦 螳 危 . 蠏碁覩襦 れ 碁煙る 蟇磯伎 .
IDX_YEAR_MONTH_DAY_HOUR_SERVER
YEAR, MONTH, DAY, LEVEL ′語れ レ 覩語讌襷 LEVEL レ 覩語讌 朱襦 IDX_YEAR_MONTH_DAY_LEVEL_TYPE 碁煙れ LEVEL 觜碁 . 企 朱 覲企 YEAR, MONTH, DAY襦 蟲焔 Non-Clustered Index 覈 蟇磯伎 . るジ 貎朱Μ 覓企Μ螳 蟆企. 貎朱Μ 襯 覲伎.
SELECT
YEAR
, MONTH
, DAY
, HOUR
, MINUTE
, TYPE
, SUM([COUNT]) AS COUNT
FROM T_CURRENT_CHARACTER_INFO
WHERE YEAR BETWEEN DATEPART(yy, '2004-05-25 00:00:00')
AND DATEPART(yy, '2004-05-26 00:00:00')
AND MONTH BETWEEN DATEPART(mm, '2004-05-25 00:00:00')
AND DATEPART(mm, '2004-05-26 00:00:00')
AND DAY BETWEEN DATEPART(dd, '2004-05-25 00:00:00')
AND DATEPART(dd, '2004-05-26 00:00:00')
AND TYPE = 30
AND LEVEL BETWEEN 100 AND 400
GROUP BY YEAR, MONTH, DAY, HOUR, MINUTE, TYPE
ORDER BY YEAR, MONTH, DAY, HOUR, MINUTE, TYPE
GO
蟆曙磯 蟇一 豕企. 讌襯 , , 朱 讓手 蟆 覩瑚 讌 . れ襦 貎朱Μ襯 ろ覃 YEAR 蟇碁Π 碁煙 襷 . Clustered Index襯 朱 讌 . 襷 Non-Clustered Index襯 る 觜 蟆企. ろ 蟆郁骸 貎朱Μ Non-Clustered Index襯 .
企. れ 1, 朱Μ 所鍵 8447, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0.
Clustered Index襯 蟆 れ螻 螳 蟆郁骸襯 覲伎.
企. れ 1, 朱Μ 所鍵 1255, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0.
襷 企 れる 朱襷殊 I/O螳 覦蟾?
企. れ 1, 朱Μ 所鍵 2026, 覓朱Μ 所鍵 4, 覩碁Μ 所鍵 223.
蟆郁骸襦 覩碁企骸 YEAR 0.5朱 蟆 . 蟆郁骸 67蟇伎企. 67蟇伎 所鍵 伎 襷 伎襯 曙. 企 語 蠏 豌 覯讌 語企. YYYY, MM, DD襯 覲牛煙朱 覲 蟆語, 殊煙朱 覲 蟆語 豢覿 螻り 伎 . 伎 螳 蟆曙磯 YYYYMMDD螳 螳企. 一危 覓語螳 . 一危 蠏豺(蠏豺 谿瑚) 覲企
TinyInt Int覲企 一螳 . 蠏碁蠍 覓語 WHERE Month = DATEPART()
TinyInt = Int 螳 觜蟲螳 覩襦 企朱 譬豸 貉殊 Month Covert(Int, Month) 螳 企 覲 殊企. 蠏碁覩襦 碁煙るゼ 讌 覈詩. 覯讌 覓語 碁煙れ 觜 煙企. MSSQL Server 一危一 ′語ろ 伎襯 曙朱り 蠍 覓語 螳 碁煙り る 朱 蠍郁 碁煙るゼ . 蠏碁覩襦 螳 蟆曙磯 Bookmark Lookup 襷 伎襯 ′語ろ 蟆企. れ 碁煙るゼ 襴螻, 貎朱Μ企.
--襷り覲襯 讌朱 覦る 螳
DECLARE @SDate CHAR(8)
DECLARE @EDate CHAR(8)
SET @SDate = CONVERT(CHAR(8), CAST('2004-05-25 00:00:00' AS DATETIME), 112)
SET @EDate = CONVERT(CHAR(8), CAST('2004-05-26 00:00:00' AS DATETIME), 112)
SELECT
YEAR
, MONTH
, DAY
, HOUR
, MINUTE
, TYPE
, SUM([COUNT]) AS COUNT
FROM T_CURRENT_CHARACTER_INFO
WHERE YEAR BETWEEN LEFT(@SDate, 4) AND LEFT(@EDate, 4)
AND MONTH BETWEEN SUBSTRING(@SDate, 5, 2) AND SUBSTRING(@EDate, 5, 2)
AND DAY BETWEEN RIGHT(@SDate, 2) AND RIGHT(@EDate, 2)
AND TYPE = 30
AND LEVEL BETWEEN 100 AND 400
GROUP BY YEAR, MONTH, DAY, HOUR, MINUTE, TYPE
ORDER BY YEAR, MONTH, DAY, HOUR, MINUTE, TYPE
GO
れ 襴 碁煙る.
れ 蟆郁骸企.
企. れ 1, 朱Μ 所鍵 144, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0.
貎朱Μ 蟆郁骸 I/O 壱 譴企 蟆 . 蟆 訖襷 , 螳煙, 焔ル 碁煙れ 螳 譴企れ朱襦 褐 蟆企. 蠍一 豕襯 貅覲伎. 豕 蟆 碁煙れ 襯 譟一 蟆企. HOUR, MINUTE 螳 螻, LEVEL 譟郁唄 一願, SERVER譟郁唄 朱襦 YEAR, MONTH, DAY, LEVEL, SERVER, CLASS, TYPE, HOUR, MINUTE 襦 譟一 覲伎.
ALTER TABLE T_CURRENT_CHARACTER_INFO
DROP CONSTRAINT PK_T_CURRENT_CHARACTER_INFO
GO
ALTER TABLE T_CURRENT_CHARACTER_INFO
ADD
CONSTRAINT PK_T_CURRENT_CHARACTER_INFO
PRIMARY KEY(YEAR, MONTH, DAY, LEVEL, SERVER, CLASS, TYPE, HOUR, MINUTE)
GO
Query 蟆郁骸 れ螻 螳.
企. れ 1, 朱Μ 所鍵 96, 覓朱Μ 所鍵 0, 覩碁Μ 所鍵 0.
伎 豕 . れ襦 企蟆 碁煙るゼ 襴 蟆 蟒 焔 螻手 . 譟壱一磯 螳讌螻 る朱 碁煙る 曙, 螳煙, 一一 企朱 讌覲伎 貊螳 ろ. 蠏碁覩襦 豌伎朱 覲伎 襷 觜 譴企.