Академический Документы
Профессиональный Документы
Культура Документы
SQLtracewithuseofPrimaryIndexandSecondaryIndex
SQLtracewithuseofPrimaryIndexandSecondary
Index
Scenario: SQL trace comparison with select statement with primary index and secondary
index.
Step1. Go to SE11.
[http://4.bp.blogspot.com/
Qh99uHFDk2Y/UmzXYzh7NtI/AAAAAAAADZc/a338e5VDqUw/s1600/1.JPG]
Step2. Provide the table name 'ZSTUDENT_DET' and click on crate button.
[http://2.bp.blogspot.com/
WGwEyU6RD6A/UmzXZyNyGYI/AAAAAAAADaE/U0iu9QUnONM/s1600/2.JPG]
[http://2.bp.blogspot.com/
e_g02bFSMBs/UmzXZ7zMYlI/AAAAAAAADaY/RUP13h3JcUs/s1600/3.JPG]
1/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/
lLUSiyMmf2Y/UmzXaCWqR2I/AAAAAAAADaQ/oQYtTnPAaW4/s1600/4.JPG]
Step5. In the FIELDS tab, Provide some fields and activate the table as shown below:
[http://1.bp.blogspot.com/hXCIJbwP9pw/UmzXaVAZ0DI/AAAAAAAADak/5y4YYtY
y60/s1600/5.JPG]
Step6. Create a TMG for the table. Navigate along the highlighted path.
[http://2.bp.blogspot.com/
aoW_l3pObfE/UmzXbAblT1I/AAAAAAAADas/CRgJTx2WgkI/s1600/6.jpg]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
2/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
Step7. Provide the function group name same as the table name, choose One Step and clink on
Find Scr. Number button.
[http://3.bp.blogspot.com/J87SvARe
G0/UmzXbMmiy9I/AAAAAAAADag/CXsKc2UG60k/s1600/7.JPG]
[http://1.bp.blogspot.com/
CaPACJDEukg/UmzXbftVC2I/AAAAAAAADaw/OssNb38NopU/s1600/8.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
3/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
J958YXQV9DM/UmzXbuVfGhI/AAAAAAAADa0/V3DVH1KlJyw/s1600/9.JPG]
[http://3.bp.blogspot.com/MgGYw9TFabU/UmzXY_F5C0I/AAAAAAAADZk/tB20w_
LMbw/s1600/10.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
4/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/8q3TsQtCBjk/UmzXY7uVavI/AAAAAAAADZ0/PYkgMvpWlyM/s1600/11.jpg]
[http://4.bp.blogspot.com/5tLTG
0ZiXk/UmzXZcmT_CI/AAAAAAAADZw/g_43KATSkb4/s1600/12.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
5/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
Wx6Ceb4fgl0/UmzYUvZZKXI/AAAAAAAADa4/QwuSlAVbiZc/s1600/13.JPG]
[http://4.bp.blogspot.com/ADXH7zs9Kos/UmzYUj35cfI/AAAAAAAADbA/27L64Nm
C4w/s1600/14.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
6/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/492rAszILC8/UmzZE6Ayt5I/AAAAAAAADcY/tiJYtnUOEFc/s1600/25.JPG]
[http://1.bp.blogspot.com/
VJpqUlpw_M/UmzZEwyFRdI/AAAAAAAADcc/bHqCpO8Y0KA/s1600/26.JPG]
[http://4.bp.blogspot.com/
crKB6luGvdE/UmzZEz5etHI/AAAAAAAADco/mJLuWsjZ1Dw/s1600/27.JPG]
Step18. It shows the Primary Index and No secondary Index .At last click on the close button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
7/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/
v4i4Cvsia2E/UmzZFcPE8jI/AAAAAAAADdA/JhfW6gvy21Y/s1600/28.JPG]
[http://4.bp.blogspot.com/DP3PGa
aV9I/UmzZFouOHlI/AAAAAAAADc8/StysodclZG0/s1600/29.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
8/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/4WEGPNppkCI/UmzZFnoeA9I/AAAAAAAADdI/61Q8j9loo5I/s1600/30.JPG]
Step21. It shows The Primary Index name and the fields that constitutes the Primary Index.
[http://2.bp.blogspot.com/
i2eCDWbNCBk/UmzZGlRu9RI/AAAAAAAADdM/HHcZr4hPHE8/s1600/31.JPG]
Step22. Let's go to SE38 to create a Report. Provide the Report name and click on the create
button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
9/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/
LFY_1QE1j8/UmzZre5LCII/AAAAAAAADdY/KHnkxcpUJZo/s1600/15.JPG]
[http://1.bp.blogspot.com/
hOC3D0ENB3k/UmzZra3AT6I/AAAAAAAADdc/tKubVN5pjX8/s1600/16.JPG]
[http://4.bp.blogspot.com/WE6KbtTKBNM/UmzZrU
VypI/AAAAAAAADdU/oj5_vbyCkZs/s1600/17.JPG]
Step25. Select the SQL Trace check box and click on the Activate Trace button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
10/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/
x4brrooIV_4/UmzZryyXpRI/AAAAAAAADdk/SdT6a4RfiGk/s1600/18.JPG]
[http://2.bp.blogspot.com/
OnaJxCT2ndU/UmzZsShQfrI/AAAAAAAADd8/Pyw5qAwnHsg/s1600/19.JPG]
Step27. Run the above report and it shows all the records form the table.
[http://1.bp.blogspot.com/
DCN2Kmnu1w0/UmzZsUBWkdI/AAAAAAAADd4/W_LPRy6ICbg/s1600/20.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
11/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/
Klz2Zl8k1DM/UmzZskXnDaI/AAAAAAAADd0/dT0Z5JtMKro/s1600/21.JPG]
[http://4.bp.blogspot.com/
dK6UwnJDoXM/UmzZtTqTtdI/AAAAAAAADeA/jdJdwPXJlrk/s1600/22.JPG]
Step30. In the selection screen Provide the name of the table 'ZSTUDENT_DET' in teh Object
Name filed and click on the F8 button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
12/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/
GvE19DKvkOU/UmzZthG7ReI/AAAAAAAADeY/nAxuupGySd8/s1600/23.JPG]
Step31. The below output is displayed. To FETCH the data (15 records) it takes 55 Millli Seconds.
[http://3.bp.blogspot.com/K
70M0e2gk/UmzZtiroMKI/AAAAAAAADeU/Qz628knVTvw/s1600/24.JPG]
Step32. Select the highlighted line with OPEN operation and click on the Explain button.
[http://4.bp.blogspot.com/
c1JQ40ffoFA/UmzaproBZdI/AAAAAAAADek/bcKcEh0Jhpc/s1600/32.JPG]
Step33. Go to Text Explain Tab and it shows the Input, Output with the Primary Index.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
13/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
bwVqupGK4xA/UmzappnzRBI/AAAAAAAADes/bUt9Zdom09A/s1600/33.JPG]
Step.34. Now go to the report and put a selectoption field and write a select statement
accordingly.
[http://1.bp.blogspot.com/
gk8hzchtuRw/UmzapjSTZGI/AAAAAAAADeo/DFfEOaBXQ78/s1600/34.JPG]
[http://4.bp.blogspot.com/BJUDIaL8Woc/UmzaqSlkg3I/AAAAAAAADe0/wZbfZYE
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
14/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
LwA/s1600/35.JPG]
Step.36 Run the report and provide some student IDs and click on F8 button.
[http://3.bp.blogspot.com/
lGwipByyVfk/UmzaqXKcUdI/AAAAAAAADe4/PYUTRmg0MF0/s1600/36.JPG]
[http://2.bp.blogspot.com/
roXyqxPBHCE/UmzaqthydlI/AAAAAAAADfE/Dv85ncJE5Fs/s1600/37.JPG]
[http://4.bp.blogspot.com/w3MCIya429o/UmzarFhOeTI/AAAAAAAADfY/klxFVC
8pNg/s1600/38.JPG]
Step.39 Again go to ST05 and deactivate the trace and display the trace.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
15/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/
viuYPFsR48E/UmzarAy5vUI/AAAAAAAADfU/D1wN48X6GoE/s1600/39.JPG]
Step.40 In the selection screen provide the table name under the Object name and click on the
F8 button.
[http://3.bp.blogspot.com/t7D5YpDEHQ/Umzargl
RcI/AAAAAAAADfc/N5VLvJrEig4/s1600/40.JPG]
Step.41 It displays the Output. It took around 38 milli second to fetch the 6 records from the
table.
[http://4.bp.blogspot.com/6NY6494bK_o/UmzasGdqPnI/AAAAAAAADfg/kSaQOA0JASo/s1600/41.JPG]
Step.42 . select the Line with OPEN operation and click on the Explain button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
16/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
VE_bF_3GuWA/UmzasIoTcLI/AAAAAAAADf8/uVkadApffcU/s1600/42.JPG]
[http://2.bp.blogspot.com/35TF6ga5VmE/UmzasoxhedI/AAAAAAAADfw/D42k5IIoims/s1600/43.JPG]
Step.44. Now go to the report and create a parameter field and accordingly put a select
statement.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
17/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://2.bp.blogspot.com/1pnJbh_R4s/UmzaslyIMeI/AAAAAAAADfs/ca
pemElY/s1600/44.JPG]
[http://3.bp.blogspot.com/eCX1mbg6V8/UmzatROL0hI/AAAAAAAADgA/_ja1uf
50ag/s1600/45.JPG]
[http://3.bp.blogspot.com/7ikyJ1kIncs/UmzatauhYAI/AAAAAAAADgc/emZBJLEPNEo/s1600/46.JPG]
18/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://2.bp.blogspot.com/
iEWRsN8P6Is/Umzat9EeKjI/AAAAAAAADgY/Tj9o81KaujQ/s1600/47.JPG]
Step.48. Go to ST05 and deactivate the trace and display the trace.
[http://3.bp.blogspot.com/
jxV7gSaz42Q/UmzauEGroWI/AAAAAAAADgU/G8by2iAbK7E/s1600/48.JPG]
Step.49 . In the selectionscreen provide the table name in the Object Name field and click on
F8 button.
[http://4.bp.blogspot.com/
vpEdmIM4A0o/Umzau0PCM0I/AAAAAAAADgo/VYulqKnenbU/s1600/49.JPG]
Step.50 . now to fetch a single record based on the primary key field it took 30 Milli Seconds.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
19/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://2.bp.blogspot.com/
j1l45xyf2fg/UmzavI4dlzI/AAAAAAAADgs/R5AXVFbQeoM/s1600/50.JPG]
Step.51 . Now select the line with operation OPEN and click on the Explain button.
[http://4.bp.blogspot.com/
xFLnLos6F0/UmzavXEWIcI/AAAAAAAADgw/sW7GR7nO62A/s1600/51.JPG]
[http://2.bp.blogspot.com/9ykk47gFiXU/UmzavyM8BEI/AAAAAAAADhA/klzxNu
LBgs/s1600/52.JPG]
Step.53. Now go to the report and create a selectoption statement with non primary key field
'NAME' and write a select statement accordingly.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
20/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/sWAj2U
1ni4/UmzcJT15QYI/AAAAAAAADhU/B2_bH_83oak/s1600/53.JPG]
Step.54 . Run the report and provide some NAMEs in the selection screen and press F8.
[http://2.bp.blogspot.com/
p23hbKjXiA4/UmzcJRsKsLI/AAAAAAAADhY/U156cRMjgfc/s1600/54.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
21/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/5prftu3YLI0/UmzcJeXqGMI/AAAAAAAADhQ/imd_SjdPUS0/s1600/55.JPG]
[http://3.bp.blogspot.com/Z0Pa0yfWhLU/UmzcKIIGjeI/AAAAAAAADhk/6i485Z
4wnc/s1600/56.JPG]
[http://2.bp.blogspot.com/2cfy4xVpDio/UmzcKMRAWDI/AAAAAAAADhg/YygTPrv9Lv8/s1600/57.JPG]
Step.58 Deactivate the trace in ST05 and click on the Display Trace button
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
22/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
uZW7oVDJ3Sk/UmzcKWLpfuI/AAAAAAAADh4/6UCJB1zUduU/s1600/58.JPG]
Step.59 > in the selectionscreen provide the table name in the Object Name field and press
F8.
[http://4.bp.blogspot.com/
X3t7uNDVQ4Q/UmzcKyJXv3I/AAAAAAAADiA/oU0wqNPUFuE/s1600/59.JPG]
Step.60. Now it took around 96 milli seconds to FETCH the 6 records based on the non primary
key. Select the line with OPEN operation and click on the Explain button.
[http://3.bp.blogspot.com/
P5sYEfx81sA/UmzcK8yKdDI/AAAAAAAADh8/vEnu5qmMKt4/s1600/60.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
23/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
FqacIwDpy0/UmzcLsg0ayI/AAAAAAAADiE/ftIqozisuXA/s1600/61.JPG]
Step.62. Now go to the table and click on the Index button to create a Secondary index.
[http://4.bp.blogspot.com/
xMNTUHDBHY/UmzcLnH3u4I/AAAAAAAADiY/gPGo7veOOVE/s1600/62.JPG]
Step.63 Click on the create button and select Create Index line.
[http://4.bp.blogspot.com/
JeXy5APre4Y/UmzcLl8DAlI/AAAAAAAADiQ/X7Iu63Eg8II/s1600/63.jpg]
24/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/
h6xkzCv97xk/UmzcMPnbe0I/AAAAAAAADig/OqBAqQK9elw/s1600/64.JPG]
Step.65. Select Unique Index and provide the field names to be a part of the primary index. Now
SAVE it and Activate the same.
[http://1.bp.blogspot.com/
iE73o8xytbg/UmzcM8gWfgI/AAAAAAAADis/vbQKJuzSi_g/s1600/65.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
25/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/Cfuzjzn7F28/UmzcM
8XWBI/AAAAAAAADiw/siXeKcLQaUQ/s1600/66.JPG]
[http://1.bp.blogspot.com/
ZP5uSoyjuCI/UmzcNK7jdDI/AAAAAAAADjQ/24XIoDHKLuM/s1600/67.JPG]
Step.68. Provide the table name 'ZSTUDENT_DET' and click on edit button.
[http://1.bp.blogspot.com/
IlQm9KP8Yb0/UmzcNtKZMjI/AAAAAAAADi0/G3p8rsQvQxw/s1600/68.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
26/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/
K5qaf3rd5zY/UmzcNjHz6ZI/AAAAAAAADjM/x3JeaYlfT1U/s1600/69.JPG]
[http://2.bp.blogspot.com/1eCfB96X6
E/UmzcOJa4kyI/AAAAAAAADjI/El66iZw3eb4/s1600/70.JPG]
[http://4.bp.blogspot.com/2HHjd11GQsc/UmzcO0sCLxI/AAAAAAAADjo/3IzBYReVFWs/s1600/71.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
27/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://1.bp.blogspot.com/24q2RPoH8A/UmzcO
gi7kI/AAAAAAAADjk/JzQC8hvunr4/s1600/72.JPG]
Step.73. It displays all the indexes of the table with field details.
[http://2.bp.blogspot.com/
bqXlPWuBe7M/UmzcPEZ_TCI/AAAAAAAADjc/lk2wvLnyg7c/s1600/73.JPG]
Step.74. Now go to the same selectoption for the NAME field and run it.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
28/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://2.bp.blogspot.com/caabnNxnqiU/UmzcPost10I/AAAAAAAADjw/jAWe4nO
VOk/s1600/74.JPG]
[http://2.bp.blogspot.com/
kIQOkZgZc4/UmzcQG1Cv0I/AAAAAAAADj0/OHrXubPoiNk/s1600/75.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
29/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://4.bp.blogspot.com/bK9yJzZ5Li8/UmzcQPtXpQI/AAAAAAAADkM/pPVR_w6p
Q8/s1600/76.JPG]
[http://1.bp.blogspot.com/rL5S27cgoqw/UmzcQgMA7CI/AAAAAAAADkA/QNLBtC6M
0s/s1600/78.JPG]
[http://4.bp.blogspot.com/
XmwdF5Ty9bI/UmzcQocQFSI/AAAAAAAADkQ/iNr293INuBc/s1600/79.JPG]
Step.80. go to ST05 and deactivate the trace and click on display trace button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
30/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/
gMeLFOTXN8Y/UmzcRIzbEjI/AAAAAAAADkY/RAcSAof6v2s/s1600/80.JPG]
Step.81. Provide the table name in the Object Name field and click on F8.
[http://1.bp.blogspot.com/
_ZimzvTyU_w/UmzcRTokHrI/AAAAAAAADkc/TZPVI2af_aE/s1600/81.JPG]
[http://3.bp.blogspot.com/
aC2L2wmHChE/UmzcRtc_grI/AAAAAAAADk8/vHG1cxb4_xE/s1600/82.JPG]
Step.83. Select the line with OPEN operation and click on Explain button.
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
31/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://2.bp.blogspot.com/qcpx0Jti
vE/UmzcR6kljKI/AAAAAAAADko/2uCtA08RzqM/s1600/83.JPG]
[http://4.bp.blogspot.com/bXWiIh8A9Ug/UmzcSNvAnwI/AAAAAAAADkw/myn
IslTnAI/s1600/84.JPG]
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
32/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
[http://3.bp.blogspot.com/83w6BTv8Z9c/UmzcSx_nHfI/AAAAAAAADlA/LWXoC0BsajE/s1600/85.jpg]
__________________________________________________________________
_____________
Posted 27th October 2013 by SPrasad
2
View comments
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
33/34
8/2/2015
SQLtracewithuseofPrimaryIndexandSecondaryIndex
1 comment
Add a comment
Top comments
http://freesapabap.blogspot.in/2013/10/sqltracewithuseofprimaryindexand.html
34/34