Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Working with Traces… Walter F. Blood Technical Director, FOCUS Division June, 2009 Working with Traces Agenda When and Why? Levels of Tracing FOCUS Code Level Engine/Database Level Typical Scenarios Additional Uses Working with Traces When and Why When will you need to work with traces? You don’t get the results you expect Your old report stops working in a new release You get a FOCUS error message – FOCnnn Your report never comes back. Your systems person calls you to complain about your activity. FOCUS abends or you get a -12 from the server. Working with Traces When and Why What can you expect? To get the report working now To find a workaround for the problem if necessary To have the problem fixed by IBI if required Working with Traces When to Trace The Key Questions 1. 2. 3. Is the machine plugged in? What is the first sign of trouble? What is actually happening? Working with Traces When to Trace 1. Is the machine plugged in? Check the obvious— Spelling and punctuation File existence FILEDEFs or ALLOCations Interface availability Security issues Sink Machine/FDS availability Tracing needed? …. Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Check description to determine nature of problem TABLE FILE CAR PRINT COUNTRY CAR MODEL AND COMPUTE SALES='$ ' | EDIT(SALES,'999$'); END > ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG1 FOCEXEC (FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD: SALES (FOC009) INCOMPLETE REQUEST STATEMENT BYPASSING TO END OF COMMAND > Tracing probably not needed Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages SET ECHO ON; DEFINE FILE CAR CONTINENT/A4=IF COUNTRY = FRANCE OR ENGLAND OR ITALY OR 'W GERMANY' THEN EUROPE ELSE ASIA; PROFIT/D12.2CML%=RETAIL_COST - DEALER_COST / DEALER_COST*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFIT BY CONTINENT BY COUNTRY ON TABLE HOLD AS HOLDCAR FORMAT FOCUS INDEX COUNTRY END -RUN TABLE FILE ABCHOLD PRINT SALES PROFIT BY CONTINENT END Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages FOCUS errors compound Solve the earliest exposed problem first! > (FOC209) THE DATA VALUE EXCEEDS ITS LENGTH SPECIFICATION: ECHO ON; ERROR AT OR NEAR LINE 3 IN PROCEDURE DBG2 FOCEXEC (FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: FRANCE ERROR AT OR NEAR LINE 5 IN PROCEDURE DBG2 FOCEXEC (FOC253) INVALID FORMAT SPECIFICATION ON LEFT HAND SIDE: D12.2CML% ERROR AT OR NEAR LINE 8 IN PROCEDURE DBG2 FOCEXEC (FOC003) THE FIELDNAME IS NOT RECOGNIZED: PROFIT BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT ERROR AT OR NEAR LINE 14 IN PROCEDURE DBG2 FOCEXEC (FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: ABCHOLD (FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: ABCHOLD BYPASSING TO END OF COMMAND Tracing may be helpful Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages Incorrect or unexpected results Work backwards from incorrect results Look for Logic errors Incorrect assumptions FOCUS errors Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages Incorrect or unexpected results DEFINE FILE CAR PROFITMARGIN/D7=((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; END TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN BY COUNTRY END PAGE 1 COUNTRY ------ENGLAND FRANCE ITALY JAPAN W GERMANY RETAIL_COST ----------45,319 5,610 51,065 6,478 64,732 DEALER_COST ----------37,853 4,631 41,235 5,512 54,563 PROFITMARGIN -----------78 21 88 35 115 Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages Incorrect or unexpected results TABLE FILE CAR SUM RETAIL_COST DEALER_COST PROFITMARGIN COMPUTE PM/D7= ((RETAIL_COST - DEALER_COST)/DEALER_COST)*100; BY COUNTRY END PAGE 1 COUNTRY ------ENGLAND FRANCE ITALY JAPAN W GERMANY RETAIL_COST ----------45,319 5,610 51,065 6,478 64,732 DEALER_COST ----------37,853 4,631 41,235 5,512 54,563 PM -20 21 24 18 19 Tracing will be helpful Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Multiple FOCUS error messages Incorrect results Abend Traces help identify FOCUS errors Dumps may be required Tracing required! Working with Traces When to Trace 2. What is the first sign of trouble? FOCUS error message Check description to determine nature of problem Multiple FOCUS error messages FOCUS errors compound Solve the earliest exposed problem first! Incorrect results Work backwards from incorrect results Look for FOCUS errors Abend Traces help identify FOCUS errors Dumps may be required Working with Traces FOCUS Level Traces-Dialogue Manager 3. What is actually happening? In Dialogue Manager: Use -SET &ECHO, -SET &STACK and SET DEFECHO to expose the actual flow of commands SET DEFECHO – Set the default value of &ECHO &ECHO=ON - Display FOCUS commands stacked & substituted &ECHO=ALL - Display FOCUS command stacked & substituted and Dialogue Manager commands &STACK=OFF – Prevent execution of the stacked FOCUS commands and system variables to test just the Dialogue Manager flow NOTE: ENCRYPTION prevents ECHO SET DEFECHO=ALL -SET &ECHO=ALL … EX pgm2 Working with Traces FOCUS Level Traces-Dialogue Manager 3. What is actually happening? In Dialogue Manager: Use SET &ECHO and SET DEFECHO to expose the actual flow of commands Use –TYPE to expose local and global variables -DEFAULT &TEST = OFF SET PRINTPLUS = ON -RUN -? SET PRINTPLUS &PRINTPLUS -SET &EVT = IF TEST EQ ‘OFF’ THEN ‘*’ ELSE ‘TYPE’; -&EVT.EVAL VALUE OF PRINTPLUS IS &PRINTPLUS Working with Traces FOCUS Level Traces - TABLE 3. What is actually happening? In TABLE: Use LET NOPRINT = ; to show complete request Use SET DEFECHO to show variable substitution Use –TYPE to expose system variable values LET NOPRINT = ; SET DEFECHO=ALL TABLE FILE CAR TABLE FILE CAR SUM RETAIL_COST SUM … BY COUNTRY NOPRINT WHERE COUNTRY EQ &VAR1 … … TABLE FILE CAR … END -RUN -TYPE RECORDS &RECORDS Working with Traces FOCUS Level Traces - MODIFY 3. What is actually happening? In MODIFY: Use MODIFY FILE xxx TRACE to locate CASE MODIFY FILE EMPLOYEE TRACE FIXFORM FROM… … CASE BADNAME …. CASE HIGHSAL **** START OF TRACE **** … TRACE ===> AT CASE TOP CASE AT START DATA FOR TRANSACTION 1 DATA EMP_ID => 112847612 END CURR_SAL => 67000 TRACE ===> AT CASE HIGHSAL YOU ENTERED A SALARY ABOVE $50000 … Working with Traces FOCUS Level Traces - MODIFY 3. What is actually happening? In MODIFY: Use MODIFY FILE xxx TRACE to locate CASE Use TYPE in CASE xxx to indicate position inside case TYPE Notes: ON <ddname> - to file, max 256 characters Embed field values using spotmarkers AT START - capture initial state of data AT END - capture final state of data Can be issued conditionally MODIFY FILE EMPLOYEE with MATCH,NEXT,VALIDATE CASE ONE TYPE “IN CASE ONE” MATCH EMP_ID TYPE “AFTER MATCH” ON MATCH UPDATE CURR_SAL ON MATCH TYPE “UPDATED VALUE <T.CURR_SAL” … Working with Traces FOCUS Level Traces – SQL Translator 3. What is actually happening? In SQL Translator: Use ECHO to show the generated FOCUS code SQL SELECT BODYTYPE, AVG(MPG), SUM(SALES) FROM CAR WHERE RETAIL_COST > 5000 > SET COUNTWIDTH=ON GROUP BY BODYTYPE; -SET SQLERRNUM = 0; ECHO TABLE FILE CAR TABLE WRITE END MIN.BODYTYPE AS 'BODYTYPE' AVE.MPG SUM.SALES BY BODYTYPE NOPRINT WHERE ( RETAIL_COST GT 5000 ) ; ON TABLE SET CARTESIAN ON ON TABLE SET ASNAMES ON ON TABLE SET HOLDLIST PRINTONLY END -RUN Working with Traces FOCUS Level Traces – SQL Translator 3. What is actually happening? In SQL Translator: Use ECHO to show the generate FOCUS code Use FILE nnn to create focexec with FOCUS code SQL SELECT BODYTYPE, AVG(MPG), SUM(SALES) FROM CAR WHERE RETAIL_COST > 5000 SET COUNTWIDTH=ON GROUP BY BODYTYPE; -SET SQLERRNUM = 0; FILE SQLTRAN1 TABLE FILE CAR WRITE TABLE MIN.BODYTYPE AS 'BODYTYPE' AVE.MPG SUM.SALES END BY BODYTYPE NOPRINT WHERE ( RETAIL_COST GT 5000 ) ; ON TABLE SET CARTESIAN ON ON TABLE SET ASNAMES ON ON TABLE SET HOLDLIST PRINTONLY END -RUN Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access SET XRETRIEVAL=OFF TABLE FILE DB2FILE SUM RETAIL_COST DEALER COST BY COUNTRY WHERE SALES GT 5000 END ...RETRIEVAL KILLED NUMBER OF RECORDS IN TABLE= 0 LINES= 0 Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity SET TRACEUSER=ON ON – Turn traces on OFF – Turn traces off <filename> - Turn traces on and place in this file ------------------------------------------------------------------On command line or in any profile or focexec Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity SET TRACEUSER=ON SET TRACESIZE=number number – maximum number of lines in trace file ---------------------------------------------------------------- Must be placed in focexec – IBITRACE Output to .trc file, overflow to .trb file, then reuse .trc file Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity SET TRACEUSER=ON SET TRACESIZE=number SET TRACEON=ALL ALL – Turn on traces for all areas Area – Turn on trace for specific area only OFF – Turn on traces for no areas – used as clear ---------------------------------------------------------------- Issue on command line or in focexec or profile Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity SET TRACEUSER=ON SET TRACESIZE=number SET TRACEON=ALL SET TRACEOFF=ALL ALL – Turn on traces for all areas Area – Turn on trace for specific area only ---------------------------------------------------------------- On command line or in focexec or profile ALL acts as CLEAR Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity Default Components – as set in Web Console R1H – Platform specific routines QOPSYS – Generic operating system functions PRH – Internal read and write routines NWH – Network and communication routines NLS – National Language support Working with Traces Engine/Database Level Traces 3. What is actually happening? With Interfaces: Use SET XRETRIEVAL=OFF to suppress data access Use Dynamic Traces to expose interface activity Typical Components – available in Web Console CEH – command input NWH2 – command output PRH – MFD and FOCEXEC read and write routines SQLAGGR - Data adapter-to-RDBMS aggregation & join analysis STMTRACE - SQL generated by the data adapter, Direct SQL Passthru Working with Traces Engine/Database Level Traces 3. What is actually happening? Special Components for SQL TRANSLATOR - SQLTRANS SQL DATA ADAPTERS - SQLDI, SQLAGGR REPORT SERVICES TABH – TABLE services WHOPT – WHERE optimizer CMPDEF – Compiled DEFINES STYLED – Styling NLS SERVICES - NLS SMART MODE - GKE MAINTAIN MNTSTMT – Statement trace MNTPERF – Statement trace and performance MNTDBMS – Database trace Working with Traces Engine/Database Level Traces 3. What is actually happening? Special Components for Legacy Data Adapters VSAM – VSAM interface FOC – FOCUS interface ADBSIN – ADABAS interface IMS – IMS interface IDMSR – IDMS interface M204IN – M204 interface DATACOM – Datacom interface XFOCUS Traces – XFOCUS, XFOCH Working with Traces Typical scenarios 4. Typical scenarios Exposing the underlying FOCUS code Complex request generation with –INCLUDE, EX and &’s SET TRACEUSER=ON SET TRACEOFF=ALL SET TRACEON=CEH//FSTRACE SET TRACEUSER=test.trc TABLE FILE CAR PRINT COUNTRY END 11.34.23 AB cepop:: 0, 00080 "TABLE FILE CAR" 11.34.23 AB cepop:: 0, 00080 "PRINT COUNTRY" 11.34.23 AB cepop:: 0, 00080 "END" Working with Traces Typical scenarios 4. Typical scenarios SET TRACEUSER=ON SET TRACEON=ALL SET TRACEUSER=test.trc Determining which files are being used Masters, Access files, data files – multiple copies 13.55.01 AS ioherrop: open name = "FILTRHOLD" 13.55.01 AS iohfnam: __main: called for fname="@0000000" funcode=QUERY 13.55.01 AS iohfnam: __main: called for fname="@0000000" funcode=QUERY 13.55.01 AS iohfnam: __main: called for fname="@0000000" funcode=QUERY 13.55.01 AS r1pathnm: result is <D:\ibi\64bit\srv76\wfs\edatemp\ts000001\filtrhold.mas> 13.55.01 AS r1fopen: calling fopen( D:\ibi\64bit\srv76\wfs\edatemp\ts000001\filtrhold.mas, r ) 13.55.01 AS r1fopen: fopen failed 13.55.01 AS r1trcerr: r1fopen: err#2, The system cannot find the file specified. 13.55.01 AS r1trcerr: iohfopen: err#2, The system cannot find the file specified. 13.55.01 AS ioherrop: name = "FILTRHOLD", : failed to open 13.55.01 AS iohfnam: __main: called for fname="@0000000" funcode=REMOVE 13.55.01 AS iohfnam: __free: new usage count 1 13.55.01 AS ioherrop: open name = "@0000000" 13.55.01 AS iohfnam: __main: called for fname="@0000000" funcode=CREATE 13.55.01 AS iohfnam: __main: new usage count: 2 Working with Traces Typical scenarios 4. Typical scenarios Locate all of the FOCUS error messages Abend often preceded by multiple FOCUS errors SET TRACEUSER=ON SET TRACEON=ALL SET TRACEUSER=test.trc EX focexec 13.54.03 AS ngptRcvT: entered 13.54.03 AS iPipeApt: entered 13.54.03 AS iPipeApt: ConnectNamedPipe, 997, Overlapped I/O operation is in progress. 13.54.03 AS ngptRcvT: accepted new connection, receiving communication type 13.54.03 AS iRecvTye: entered 13.54.03 AS ngptRcvT: socket connection request, type=0 13.54.03 AS ngptRcvT: connection etype=0 13.54.03 AS ngptRcvT: cth len = 179 13.54.03 AS iRecvSok: entered 13.54.03 AS iRecvSok: sent PID 13.54.03 AS iRecvSok: received socket info, sending confirmation 13.54.03 AS ngptRcvT: socket successfully received 13.54.03 AI nwnget: entered 13.54.03 AI nwnget: receiving from client Search file for “FOC” Working with Traces Typical scenarios SET TRACEUSER=CLIENT SET TRACEOFF=ALL SET TRACEON=STMTRACE SET TRACEON=SQLAGGR 4. Typical scenarios Work with interface traces … FILENAME=abctraining, SUFFIX=SQLMSS , $ SEGMENT=ABCEMPDATA, SEGTYPE=S0,$ FIELDNAME=PIN, ALIAS=PIN, USAGE=A9, ACTUAL=A9, $ FIELDNAME=LASTNAME, ALIAS=LASTNAME, USAGE=A15, ACTUAL=A15, $ FIELDNAME=FIRSTNAME, ALIAS=FIRSTNAME, USAGE=A10, ACTUAL=A10, $ .. DEFINE NEW_PIN/A9 WITH ABCEMPDATA.PIN='000567890'; $ DEFINE STATE/A6 WITH ABCEMPDATA.PIN= IF ABCEMPDATA.PIN EQ ‘000567890' THEN ‘NJ' ELSE IF ABCEMPDATA.PIN EQ ‘000456780' THEN ‘NY' ELSE 'XX'; $ SEGMENT=ABCTRAINING, SEGTYPE=S0, PARENT=ABCEMPDATA, CRJOINTYPE=INNER, $ FIELDNAME=PIN, ALIAS=PIN, USAGE=A9, ACTUAL=A9, $ FIELDNAME=COURSECODE, ALIAS=COURSECODE, USAGE=A7, ACTUAL=A7, $ FIELDNAME=COURSESTART, ALIAS=COURSESTART, USAGE=HYYMDs, ACTUAL=HYYMDs, $ ENGINE SQLMSS SET OPTIMIZATION SQL TABLE FILE ABCTRAINING PRINT LOCATION LASTNAME FIRSTNAME COURSESTART ... END Working with Traces Typical scenarios 4. Typical scenarios … to ensure request optimization 16.07.33 BR (FOC2510) FOCUS-MANAGED JOIN SELECTED FOR FOLLOWING REASON(S): 16.07.33 BR (FOC2511) DISABLED BY USER 16.07.33 BR (FOC2598) FOCUS IF/WHERE TEST CANNOT BE PASSED TO SQL : ODS_PAYME 16.07.33 BR (FOC2590) AGGREGATION NOT DONE FOR THE FOLLOWING REASON: 16.07.33 BR (FOC2592) RDBMS-MANAGED JOIN HAS BEEN DISABLED 16.07.33 AE SELECT T1."ODS_PAYMENTECH_D1_TX_DATE", 16.07.33 AE T1."ODS_PAYMENTECH_D1_CARD_TYPE", 16.07.33 AE T1."ODS_PAYMENTECH_BH_TERM_NUM",T1."ODS_PAYMENTECH_D1_CARD_NUM", 16.07.33 AE T1."ODS_PAYMENTECH_D1_AUTH_NUM", 16.07.33 AE T1."ODS_PAYMENTECH_D1_TX_SEQ_NUM",T1."ODS_PAYMENTECH_D1_TX_AMT", 16.07.33 AE T1."ODS_STOR_CODE",T1."ODS_PAYMENTECH_BH_BATCH_NUM", 16.07.33 AE T1."ODS_PAYMENTECH_D1_RECORD_TYPE", 16.07.33 AE T1."ODS_PAYMENTECH_D1_TX_CODE",T1."ODS_PAYMENTECH_D1_VOID_FLAG", 16.07.33 AE T1."ODS_PAYMENTECH_D2_AUTH_TYPE", 16.07.33 AE T1."ODS_PAYMENTECH_D3_ENTRY_DATA_SOURCE", 16.07.33 AE T1."ODS_PAYMENTECH_D4_RETAIL_INDUSTRY_DATA" FROM 16.07.33 AE VODS_ODS_PAYMENTECH T1 WHERE 16.07.33 AE (T1."ODS_PAYMENTECH_D1_RECORD_TYPE" <> '3'); … Working with Traces Typical scenarios 4. Typical scenarios … to check data that is returned from database 13.54.03 BX Value: 1 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC 13.54.03 BW <<< OLEFOC SQLDA Block SQLDA: Contains 6 elements, 6 select list expressions SQLDA: Name= E01, Addr= 00000000006364F0 SQLDA: Type= Char(01C5), Length= 0040 SQLDA: Indicator= Addr: 000000000240C136: 0000 SQLDA: Data= Addr: 000000000240C138: BUS_SEGMENT SQLDA: Name= E02, Addr= 0000000000636568 SQLDA: Type= Char(01C5), Length= 0040 SQLDA: Indicator= Addr: 000000000240C17E: 0000 SQLDA: Data= Addr: 000000000240C180: Business Segment SQLDA: Name= E03, Addr= 00000000006365E0 SQLDA: Type= Char(01C5), Length= 0040 SQLDA: Indicator= Addr: 000000000240C1C6: 0000 SQLDA: Data= Addr: 000000000240C1C8: Business_Segment_Cd SQLDA: Name= E04, Addr= 0000000000636658 SQLDA: Type= Char(01C5), Length= 0040 SQLDA: Indicator= Addr: 000000000240C20E: 0000 SQLDA: Data= Addr: 000000000240C210: Business_Segment_Desc Working with Traces Typical scenarios 4. Typical scenarios … to ensure that SQL request completed returning data 15.44.03 EW Command: Finish on segment 0 15.44.03 BU DQ: --- DQFIN , engine = SQLORA , session count = 0 15.44.03 BW >>> OR8FOC entered. (SQLORA), Gfun= 3, fun= 6; FOCUS_CLOSE. 15.44.03 BX **** or8foc: gfun: 3, fun: 6, cnum: 0 15.44.03 BX **** OCIHandleFree(errhp) call 15.44.03 BX **** OCIHandleFree return 15.44.03 BX **** status=0, "OCI_SUCCESS" 15.44.03 BX **** OCIHandleFree(envhp) call 15.44.03 BX **** OCIHandleFree return 15.44.03 BX **** status=0, "OCI_SUCCESS" 15.44.03 AR vxndel: delete request for module: ORAPAS2 --- dummy 15.44.03 BW <<< OR8FOC exited. (SQLORA), Errcode= 0; FOCUS_CLOSE. Working with Traces Typical scenarios 4. Typical scenarios Savediags include the following traces-- Server log ($EDACONF/edaprint.log) Traces and other contents from the $EDACONF/edatemp/... directory, including the following: edachkup.trc Daemon check up facility trace edapdfm.trc Deferred Listener trace edaplog.trc EDAPRINT log daemon trace fds.trc FDS trace jscom*.trc Java traces edapth.trc Main workspace manager trace edaphtp.trc HTTP communication traces (listener) ht000nnn.trc HTTP communication traces (threads) edaptcp.trc TCP/IP communication traces (listener) ip000nnn.trc TCP/IP communication traces (threads) lu000nnn.trc SNA communication traces ts000nnn.trc Agent traces Server configuration ($EDACONF/bin/edaserve.cfg) Profiles from $EDACONF/etc/edasprof.prf and ibi/profiles/* Working with Traces Additional uses 4. Additional uses Performance issues Look for search issues with multiple folders in path Check optimization Check timing of access Look for non-essential parsing Optimization WHERE Aggregation JOIN FOCUS Debugging Techniques Performance