안녕하세요~ 무더운 날씨입니다. 궁금한 내용이 있어서요


프로시저를 작성하였고 sqlserver 제공 암호화 한것을 복호화 하여 조인합니다.

프로시져를 직접 실행하면 1초도 안되서 나옵니다. (데이터도 1천건이 안됩니다.)


하지만. asp.net mvc + EnterpriseLibrary 를 통해서 불러오면 타임 아웃 걸립니다.

 SqlException (0x80131904)


CommandTimeout = 0 으로 조절하면 불러오긴 하지만 너무 오래 걸립니다. 

이것저것 해봐도 모르겠어서 질문 남깁니다.


모니터링 툴로 확인해보면 첨부한 이미지와 같은 내용이 몇 십만건이 발생됩니다.

왜 그런지 힌트좀 주실수 있을까요?




richzeus_sql.PNG



프로시져 내용은 아래와 같습니다.

 exec usp_common_openkey;
select * from
	(
	select top (@nextPage)
	ROW_NUMBER() over (order by a.RegDate desc) as RowNumber
	,	a.RegDate
	,	e.coName as Ptype
	,	dbo.uf_DecData(a.GiftNo) as GiftNo
	,	d.Ptitle
	,	d.SaleCode
	,	isnull(a.RemainAmt,0) as RemainAmt
	,	d.SendMobileNo
	,	convert(varchar(10) ,a.ExpireDate2, 120) as ExpireDate2
	,	convert(varchar(10) ,a.ReturnDate, 120) as ReturnDate
	,	convert(varchar(10) ,(DateAdd(DAY,-7,a.ExpireDate2)), 120) as Daybefore7
	,	convert(varchar(10) ,(DateAdd(DAY,30,a.ExpireDate2)), 120) as Daylater30
	,	f.ShopName
	,	a.GiftState
	,	b.coName as JongName
	,	c.coName as GiftStateName
	
	from GiftMst a with (nolock)
	left outer join CodeDetail b with (nolock) on (a.Jong = b.coCode and b.coGroup = 12)
	join CodeDetail c with (nolock) on (a.GiftState = c.coCode and c.coGroup = 24)
	join SaleDtl d with (nolock) on (dbo.uf_DecData(a.GiftNo)= dbo.uf_DecData(d.GiftNo))
	left outer join CodeDetail e with (nolock) on (d.Ptype = e.coCode and e.coGroup = 10)
	left outer join Shops f with (nolock) on (f.ShopCode = a.ShopCode)
where a.RegDate between convert(datetime, @Sdate + ' 00:00:00', 120) and convert(datetime, @Edate + ' 23:59:59', 120)
and (case when @S_Type = '' then '' else d.Ptype end) = @S_Type 
and (case when @JongList = '' then '' else d.Jong end) = @JongList 
and (case when @GiftState = '' then '' else a.GiftState end) = @GiftState
and (case @KeyCode 
			when 'GiftNo' then dbo.uf_DecData(a.GiftNo)
			when 'ShopName' then f.ShopName
			when 'MobileNo' then  d.SendMobileNo
			else '' end) like (case when @KeyCode = '' then '' else @Keyword  end)
and (
		(case when @KeyCode = '' then dbo.uf_DecData(a.GiftNo) else '' end) like (case when @KeyCode = '' then @Keyword else ''  end)
	or (case when @KeyCode = '' then f.ShopName else '' end) like (case when @KeyCode = '' then @Keyword else ''  end)
	or (case when @KeyCode = '' then d.SendMobileNo else '' end) like (case when @KeyCode = '' then @Keyword else ''  end)
)
) a where RowNumber between @prevPage and @nextPage	



No. Subject Author Date Views
Notice SQL강좌: 챗GPT와 함께 배우는 SQL Server 무료 강좌 목차와 소개 (2023년 9월 업데이트) 코난(김대우) 2023.08.18 1093
Notice Python 무료 강좌 - 기초, 중급, 머신러닝(2023년 6월 업데이트) 코난(김대우) 2021.01.01 1666
7936 테이블 여러개를 묶어서 한개의 테이블을 만드는게 가능한가요?? dodanto 2014.06.12 2124
7935 잘 되던 Linked Server가 갑자기 안됩니다 [2] 토토로 2014.06.12 2999
7934 두테이블 데이터를 한줄로 보깅.. [3] 마힐링 2014.06.11 3610
7933 트랜잭션 격리 수준에 대한 문의? 힘차게 2014.06.11 2910
7932 간단히 할수 있는 방법이 있을까요?? 아수라발발타 2014.06.11 2600
7931 가상테이블더하기 ^^ [3] 마힐링 2014.06.10 4263
7930 스칼라 변수 선언 [1] hhhh 2014.06.10 16311
7929 안녕하세요? sql 백업파일로 살릴수 있는 건거 궁금해서 질문드립니다. [1] 타우렌 2014.06.10 2464
7928 회사 ERP접속관련 급하게 문의 드립니다..ㅠ [5] 쌍이a 2014.06.10 3387
7927 시간대별 통계량을 뽑고싶습니다. [2] 나난나아 2014.06.09 3694
» 타임 아웃 문의 - SqlException (0x80131904) [7] jw0130 2014.06.09 3730
7925 에러 로그만 dump를 할 수 있나요? [1] 나는짱이야 2014.06.09 2386
7924 안녕하세요 신입입니다. MSSQL관련 질문 드립니다. [2] 오잉뿌잉빵 2014.06.09 2678
7923 한 필드에 데이터가 너무 많습니다. 엑셀로 내려 받으려면 [2] 와우호스트 2014.06.09 3133
7922 해당 쿼리를 만들려고 하는데 ... 도저히 않되네요... [7] ssunsori 2014.06.08 2792
7921 스칼라 서브쿼리 관련된 질문 드려요 ㅠㅠ [3] 으리 2014.06.08 3183
7920 Option Recompile 에 대한 사이드이펙트가 있을까요? [4] 프리윈드 2014.06.07 3248
7919 쿼리점 만들어주셍 ㅠㅠ [1] 입문mysql 2014.06.06 2427
7918 증감수 다른 것으로 여쭤봐용 ㅜㅠ [2] 마힐링 2014.06.05 2726
7917 복합키와 대체키 성능관련하여 질문합니다. AceCarrot 2014.06.05 4571





XE Login