RPC Event RPC Message RPC Event SQL Language
- Slides: 41
RPC Event를 통하지 않은 호출 RPC Message (RPC Event) SQL Language Message (Batch Event) SET rs = New ADODB. Recordset. . . rs. Open “EXEC Proc param 1”. . . cmd. Connection = cnn; cmd. Command. Text = “dbo. Proc”; cmd. Command. Type = Stored. Procedure; NO cmd. Parameters. Add(“@member_no” , Sql. Db. Type. Int , 4). Value = param_value; . . . rdr = cmd. Execute. Reader(); NO cmd. Connection = cnn; cmd. Command. Text = “EXEC Proc param 1”; cmd. Command. Type = Command. Type. Text; rdr = cmd. Execute. Reader(); SQL 엔진이 원하는 것은 RPC Event 실행 계획 재사용 능력 및 성능 향상 파라미터 Caching/재사용 능력 제공 SQL Injection을 포함한 보안 강화
파라미터 개체 자동 생성 Parameter 개체 암시적 생성 NO WITH cmd. Active. Connection = cn. Command. Text = “Proc”. Command. Type = ad. Cmd. Stored. Proc 혹은 이것도 생략 가능. Parameters. Refresh. Parameters(1). Value = 1000. . . 추가 Request, I/O 등 성능 문제 유발 sp_procedure_params_rowset 실행 서버의 라운드 트립 유발 시스템 테이블 접근 유발-sysobjects 등
파라미터 암시적 데이터 형식 지정 Parameter 데이터 형식의 생략 혹은 암시적 지정 NO cmd. Connection = cnn; cmd. Command. Type = Command. Type. Text; cmd. Command. Text = “SELECT * FROM dbo. member WHERE firstname = @fname”; cmd. Parameters. Add. With. Value(“@fname”, lst. Fname. Selected. Item); . . . App/DB에서 암시적 형 변환 유발 불필요한 Procedure Cache 소비 SARG 위반할 경우 성능 문제 유발 Parameterized Query에서 특히 주의
SARG 위반 CREATE PROC dbo. up_1 @ID char(2) AS SELECT * FROM dbo. table WHERE char_col LEFT(char_col, 2) = @ID LIKE @ID. . . CREATE PROC dbo. up_3 @ID char(10) @ID varchar(5) AS SELECT * FROM dbo. table WHERE char_col LIKE RTRIM(@ID) @ID <column_name> <inclusive_operator> <value> [AND…] CREATE PROC dbo. up_2 @IDvarchar(5) int @ID AS SELECT * FROM dbo. table WHERE char_col = @ID CREATE PROC dbo. up_4 @ds datetime AS. . . SET @s = @ds + 7 SELECT * FROM dbo. table WHERE date_col BETWEEN @ds AND (@ds+7) @s @ds AND @ds 2
Parameter Sniffing • 문제: (초기/재)컴파일 시 사용된 파라미터로 생성된 실행 계획 이, 재사용 시에는 잘못된 실행 계획이 되는 경우 @B_Date=‘ 19960710’ @E_Date=‘ 19960930’ FROM dbo. Orders WHERE Order. Date Between @B_Date AND @E_Date @B_Date=‘ 19960710’ @E_Date=‘ 19960711’ 선택도 = 65/830 실행계획 = CL Index Scan 선택도 = 2/830 실행계획 = Index Seek
동적 검색 조건-예제 모든 경우의 수에 따른 성능 확인 필요 @orderid int = NULL , @fromdatetime = NULL , @todatetime = NULL , @prodname nvarchar(40) = NULL 개별 구문 별 재사용 처리. . . SELECT @sql = 'SELECT * FROM Northwind. dbo. Orders o JOIN Northwind. dbo. [Order Details] od 동일 구문에 대해서는 여전 ON o. Order. ID = od. Order. ID 히 재사용 문제 내포 JOIN Northwind. dbo. Products p ON p. Product. ID = od. Product. ID WHERE 1 = 1 ' 프로시저와 다른 Scope로 처리 IF @orderid IS NOT NULL Recompile 강제 어려움 SET @sql = @sql + 'AND o. Order. ID = @xorderid ' sp_recompile 테이블 IF @fromdate IS NOT NULL SET @sql = @sql + 'AND o. Order. Date >= @xfromdate ' IF @todate IS NOT NULL SET @sql = @sql + 'AND o. Order. Date <= @xtodate ' IF @prodname IS NOT NULL SET @sql = @sql + 'AND p. Product. Name LIKE @xpname + ''%'' '. . . EXEC sp_executesql @sql, @paramlist, @orderid, @fromdate, @todate, @prodname
추가 자료들 • Microsoft SQL Server Query Processor Internals and Architecture http: //msdn. microsoft. com/library/default. asp? url=/library/enus/dnsql 7/html/sqlquerproc. asp • (기술자료) 저장 프로시저 재컴파일 문제 해결 http: //support. microsoft. com/kb/243586/ko • Microsoft SQL Server 성능 튜닝 Technical Reference Whalen, Garcial, Deluca, Thompson | 정보문화사 • Inside Microsoft SQL Server 2000 Kalen Delaney | 정보문화사 • SQL Server 최적화 튜닝 정원혁, iti 교육센타 • Programming a Microsoft SQL Server 2000 Database 2073, MOC 교육 과정
여러분의 Microsoft 기술 능력 평가 Microsoft Skills Assessment 무엇인가? • 현재 제품 및 기술 솔루션에 대한 능력 평가 • Windows Server 2003, Exchange Server 2003, Windows Storage Server 2003, Visual Studio. NET, Office 2003 • 무료, 온라인, 누구나 사용 가능 • 평가결과를 기초로 Microsoft 교육 프로그램을 제안합니다. • 평가항목과 최고점수 표시 • 방문하세요! www. microsoft. com/assessment
Specialization 인증을 도전하세요. • MCSA/MCSE specializations? – IT 전문가를 위한 메시징, 보안 전문분야의 인증제도 • 현재 인증 가능한 전문? – MCSA: Security – MCSE: Security – – MCSA: Messaging MCSE: Messaging • 자세한 정보는 아래 URL를 참고하세요? www. microsoft. com/mcsa or www. microsoft. com/mcse
어디서 정보를 얻을 수 있나요? • 웹 캐스트 또는 온라인 채팅 www. microsoft. com/technet/community/chats www. microsoft. com/technet/community/webcasts • 뉴스그룹 목록 www. microsoft. com/technet/community/newsgroups • Microsoft 커뮤니티 사이트 www. microsoft. com/technet/community • 커뮤니티 이벤트 www. microsoft. com/technet/community/events • 커뮤니티 칼럼 www. microsoft. com/technet/community/columns
- Rpc message format
- Set serveroutput on
- Sql developer unit test
- What does sentinel event mean
- Worksheet 12-8 compound probability
- Independent event vs dependent event
- Dependent events examples
- Swot analysis of event management company
- Bridge breaks in central java
- Chaernobyl
- Sql high level language
- Oracle procedural language extensions to sql
- Convert natural language to sql query
- Introduction to structured query language (sql)
- Introduction to structured query language (sql)
- What does sql stand for?
- A structured query language – sql operators are
- Select * from tab
- Data manipulation language in sql
- Structured query language (sql) is an example of a(n)
- Structured query language (sql) is an example of a(n)
- Sql nn
- Embedded rpc
- Rpc and rmi
- Rpc diagram
- Rpc semantics in the presence of failures
- Rpc computer science
- Rpc woerden
- Rpc vs rmi
- Statutory rape rpc
- List some remote procedure call (rpc) issues.
- Beton ductal
- Vermeer rpc packet
- Transaction processing system architecture
- Avalanche rpc
- What is the primary motivation for development of rpc?
- Openchain rpc
- Rpc implementation in distributed system
- The rpc server is unavailable - error code:6ba
- Rpc construction
- Design issues of remote procedure call
- Rpc vs ipc