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


프로시저를 작성하였고 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 42995
Notice Python 무료 강좌 - 기초, 중급, 머신러닝(2023년 6월 업데이트) 코난(김대우) 2021.01.01 22751
7943 데이타 자장시 오류는 없는데 짤려서 들어갑니다.ㅠㅠ [2] 김영환_281520 2014.06.17 2531
7942 이게 가능한지 몰라서 일단 질문 올려 봅니다. [6] 나는짱이야 2014.06.16 2594
7941 질문드립니다.(가로 출력) [5] 차차리아카 2014.06.16 2389
7940 윈도우8 환경에서 클라이언트 네트워크 유틸리티에 대하여.. [1] 김민엽_279256 2014.06.14 3191
7939 캐시 관련 궁금한사항이 있습니다. 아시는 분 답변 부탁드려요 !! [4] spica 2014.06.13 2888
7938 특정 조건을 만족하는 경우의 지속시간, 횟수 구하기 [4] sqlnovice 2014.06.13 3134
7937 프로시져에서 인서트나 업데이트시에 [1] 아싸라비아콜롬비아 2014.06.13 3047
7936 테이블 여러개를 묶어서 한개의 테이블을 만드는게 가능한가요?? dodanto 2014.06.12 2164
7935 잘 되던 Linked Server가 갑자기 안됩니다 [2] 토토로 2014.06.12 3037
7934 두테이블 데이터를 한줄로 보깅.. [3] 마힐링 2014.06.11 3647
7933 트랜잭션 격리 수준에 대한 문의? 힘차게 2014.06.11 2958
7932 간단히 할수 있는 방법이 있을까요?? 아수라발발타 2014.06.11 2642
7931 가상테이블더하기 ^^ [3] 마힐링 2014.06.10 4283
7930 스칼라 변수 선언 [1] hhhh 2014.06.10 16477
7929 안녕하세요? sql 백업파일로 살릴수 있는 건거 궁금해서 질문드립니다. [1] 타우렌 2014.06.10 2503
7928 회사 ERP접속관련 급하게 문의 드립니다..ㅠ [5] 쌍이a 2014.06.10 3433
7927 시간대별 통계량을 뽑고싶습니다. [2] 나난나아 2014.06.09 3727
» 타임 아웃 문의 - SqlException (0x80131904) [7] jw0130 2014.06.09 3787
7925 에러 로그만 dump를 할 수 있나요? [1] 나는짱이야 2014.06.09 2417
7924 안녕하세요 신입입니다. MSSQL관련 질문 드립니다. [2] 오잉뿌잉빵 2014.06.09 2711





XE Login