Académique Documents
Professionnel Documents
Culture Documents
Page 1
Exercise Overview
Unit 1 DB2 LUW Administration in General
1 1 1 1 1 1 Get familiar with DBACockpit Understand DB2 database Key Performance Indicators (KPIs) Understand DB2 configuration Get familiar with Single Table Analysis feature Buffer pool and table space maintenance Use db2look tool
Page 2
DB2 LUW for SAP BW Lab Exercises Unit 6 Deep Compression for SAP BW
35 35 35 35 35 Compress an existing fact table Check new table size Run query against the new fact table Analyze the new access plan Check DB2 compression related BI parameter
Unit 7 BI Operations
36 37 38 39 40 Compress an InfoCube Run query against a compressed InfoCube Create an aggregate Check aggregate table structure and storage parameters Run query against an aggregated InfoCube
Page 3
Unit 1 DB2 LUW Administration in General System ID : N4S Database server : n4shost System number : 42 1.1 Logon data User ID : bwuser Password : sapn4sadm Run transaction DBACockpit (or ST04), and found out the following KPIs: 1. buffer pool quality on database level and on each table space level? 2. package cache and catalog cache quality, any cache overflow? 3. any lock escalation and dead locks? 4. any sort overflow? Find out the following DB2 configuration information: 1. what is the value for the registry variable DB2_WORKLOAD? 2. what is the value for the database manager (DBM) configuration parameter INSTANCE_MEMORY? 3. what is the value for the database (DB) configuration parameter DATABASE_MEMORY? 4. what is the TCPIP port number used by db2 instance? check SVCENAME configuration parameter DBACockpit -> Space -> Single Table Analysis, type in Table name /BIC/FZSD_C01, hit Enter 1. whats the table size? How many rows (cardinality)? 2. when was the last time the table statistics was collected? 3. how many indexes have been defined? 4. check table structure, index structure 1. create a new buffer pool BP32K with 32K page size and 100 pages Note: due to a bug in DBACockpit -> Configuration -> Buffer Pools -> Add, we have to create this buffer pool from DB2 command line: db2 "create bufferpool bp32k size 100 pagesize 32k" 2. Add a table space myspace from DBACockpit, with automatic storage feature, 32K page size and assign BP32K to it 3. enable DIO by altering table space to NO FILE SYSTEM CACHING on DB2 command line, db2 "alter tablespace myspace no file system caching" 4. delete the tablespace myspace and the buffer pool BP32K from DBACockpit. 1. 1.6 Use db2look tool 2. Retrieve the current layout of the database: db2look -d n4s -l > db_layout.txt Retrieve the definition and statistics of a SAP BW specific table, e.g. /BIC/FZSD_C01: db2look -d n4s -u sapn4s -z SAPN4S -e -m -t "/BIC/FZSD_C01" > zsd_c01.txt
Page 4
Unit 2 BI Objects in DB2 Run transaction RSA1: Data Warehouse Workbench On the left navigation panel, select Modelling InfoProvider
benchmark
This will give you an over view of which InfoProviders will be used in the lab.
Run transaction RSA1 Modeling InfoProvider Select benchmark Select Benchmarkcube and right-click Select Manage Select Contents tab Select button Fact Table Table name is shown in header line.
Edit
On this screen, you can use Indexes button to see all indexes defined on this fact table, use Storage Parameters button to check DB2 specific storage parameters, use Check button to verify the consistency between SAP data dictionary (DDIC) and physical database table.
Page 5
To check the table structure use button Storage Parameter. From here you can find the partitioning key definition, and which index is defined as clustering index.
Page 6
Execute
The extended star schema for this InfoCube, including fact table, all dimension tables and master data tables, are displayed.
Check table and index statistics, table and index structure, etc.
Write down the Total Table Size, Total Index Size and No. of Pages with Data to the Work Sheet on the final page of this hand book.
Page 7
Select button New Data ODS activation queue table name is shown in heading: /BIC/AODSBENCH40 Select button Active Data ODS active table name is shown in heading: /BIC/AODSBENCH00 Select button Change Log ODS change log table name is shown in heading: /BIC/B0000002000 In SE14, enter table name /BIC/AODSBENCH40, /BIC/AODSBENCH00, and /BIC/B0000002000 Find out their partitioning keys, indexes, etc. In DBACockpit -> Space -> Single Table Analysis, enter table name /BIC/AODSBENCH40 and /BIC/AODSBENCH00 Find out their table and index structures, statistics, etc. In order to find out the PSA table name, go to SE16, enter table name RSTSODS, click Enter. On the Data Browser screen, enter ZBENCH* in the field ODSNAME, click Execute button.
2.8 Check ODS table storage parameters 2.9 Check ODS table structure
Page 8
From here we can see the PSA table name is /BIC/B0000020000. 2.11 Check PSA table storage parameters 2.12 Check PSA table structure
In SE14, enter table name /BIC/B0000020000, find out their partitioning keys and index definition. In DBACockpit -> Space -> Single Table Analysis, enter table name /BIC/B0000020000 Find out their table and index structures, statistics, etc. Run transaction RSA1 signed Characteristics Modeling InfoObjects Unassigned Nodes UnasSearch for Customer Number and double click.
What master data tables have been created for InfoObject 0CUSTOMER? Write down the SID table name, and other master table names. Use SE14 and Single Table Analysis to check each table. You can also use SE16 to display table contents.
Page 9
Unit 3 Scaling out SAP BW database Prerequisites: There is a bug in this version of the SAP/DB2 Test Drive DVD, which causes the BI Data Distribution Wizard to run under a userid with insufficient authority to alter tablespaces. The work around is to grant sapn4s SYSADM authority, by running the following command as root user: usermod -g dbn4sadm sapn4s Preparation for scaling out database: 3.1 Create a new database partition group 1. In the SAP GUI, open transaction dbacockpit and click Configuration -> Database Partition Groups. Click the Add button, and enter NGRP_FACT_NEW for the name, then click the Add button at the top of the screen and confirm the creation. By default, this new partition group will include all partitions available. At this time, there is only one partition partition 0. Click Space -> Tablespaces to view the list of tablespaces. Click the Add button, and enter NEW#FACTD as the tablespace name, and select NGRP_FACT_NEW as the partition group and 16K page size. Ensure AutoStorage is selected and then click the Add button at the top of the screen to create this new tablespace; repeat the same steps to create another table space NEW#FACTI, make sure to select NGRP_FACT_NEW as the partition group and 16K pagesize. Click Configuration -> Data Classes to add a new data class. Click the Add button, and enter ZFACT as the Data Class name with the description New Fact Tables, and select NEW#FACTD as the Data Tablespace, NEW#FACTI as the Index Tablespace. Then click the Add button to create this data class.
2.
3.
Page 10
Right click on the My InfoArea, and select Create InfoCube. On the Edit InfoCube pop-up window, change the InfoCube name to ZSD_C02, enter the description, select the Copy From cube as ZSD_C01, and click Create button.
DB Performance
Main-
On the Maintain Storage Parameters screen, change the Data Type of both InfoCube and Aggregate to the new data class ZFACT and click on Continue button. *Note* if you dont see ZFACT being displayed in the drop-down list, you might have to run a transaction /$SYNC to refresh the SAP table buffer. It seems to be an error in buffer synchronization for table DDART. On the DW workbench, click Activate button to activate the new InfoCube. Click Save button to save all changes. You will notice the InfoCube object
Page 11
On the Change DataSource ZBENC_ZSD_C02(BENCH) screen, under General Info tab, change all descriptions to zbench_zsd_c02:
under Extraction tab, select the Adapter Load Text-Type File from Application Server, and enter te File Name
Page 12
Go to the Proposal tab. On the rows for column Field Name with values VERSION, SOLD_TO, MATERIAL and BASE_UOM, change corresponding Format column value to External. Click Activate button to activate this DataSource. Accept the prompt of warning message. You can test the DataSource by using Read Preview Data under the Preview tab. On the newly created DataSource zbench_zsd_c02, right click, choose Create Transformation On the Create Transformation screen, select Object Type InfoCube and enter the Name ZSD_C02. Hit Enter.
On the Transformation Creat screen, if you hit Ctrl-F2, or choose menu item Transformation Check, you will see the Log Display screen which shows a number of error messages.
Page 13
This is because these target fields need to be associated with either a unit or a currency. On the field mapping window, right click on the link that leads to one of these target field, e.g. OCRMEM_CST, select Rule Details.
On the Rule Details screen, use the drop-down list for the field Source Currency to select STAT_CURR for the Source Currency, then click on button Transfer Values.
Page 14
For the target fields that require a Source Unit, select BASE_UOM as the Source Unit. Repeat this step for every target field that requires either a Source Currency or a Source Unit, until Ctrl-F2 check returns no error (you can ignore three warning messages regarding 0CALMONTH, etc.) Click on Activate button to activate this Transformation. 3.8 Create InfoPackage On the newly created DataSource zbench_zsd_c02, right click, choose Create InfoPackage On the Create InfoPackage screen, enter the description InfoPackage for trans1 data file
Page 15
On the Creation of Data Transfer Process window, click Activate button to activate this DTP. On the Display Data Transfer Process screen, choose Execute tab, and click on Execute in the Background button, 3.11 Load data to the InfoCube ZSD_C02 Click Yes to the question Do you want to display the request monitor?. On the Data Transfer Process monitor screen, click Refresh button to check job status until the job is completed. Run transaction DBACockpit Space Single Table Analysis, Enter table name /BIC/FZSD_C02, hit Enter Click button RUNSTATS in Dialog, after the runstats finishes, you should see the table Cardinality is 13640. 3.12 Check ZSD_C02 Fact table
Page 16
Make sure DB2 instance is stopped. Otherwise you could force to stop DB2 instance:
n4shost:n4sadm 52> db2stop force
Then, open a new terminal window under user root, go to the directory /storage/sapinst, and launch sapinst program:
n4shost:~ # cd /storage/sapinst n4shost:/storage/sapinst # ./sapinst
On sapinst screen, select the service SAP NetWeaver 7.0 Support Release 3 -> Software Life-Cycle Options -> Database Tools -> IBM DB2 for Linux, UNIX, and Windows -> Additional Database Partitions.
Click on Next button. On the following sapinst screen, enter the corresponding
Page 17
Click Next button on the Parameter Summary screen, and the spainst starts to run. At the end, you should receive the following screen saying Additional Database Partitions has been completed successfully.. Click OK to exit sapinst screen.
This shows the partition 1 has been added. After the partition 1 has been added, we need to change some configuration parameter values in order to run the work loads in the following lab exercises.
n4shost:db2n4s 53> cd /storage/scripts n4shost:db2n4s 55> db2 -tvf update_db_cfg_node1.clp !mkdir /db2/N4S/log_dir/NODE0001 mkdir: cannot create directory `/db2/N4S/log_dir/NODE0001': File exists update dbm cfg using instance_memory 250000
Page 18
n4shost:db2n4s 56> db2stop 01/27/2009 13:18:40 successful. 01/27/2009 13:18:45 successful. SQL1064N DB2STOP processing was successful. 1 0 SQL1064N DB2STOP processing was 0 0 SQL1064N DB2STOP processing was
We are going to restart SAP system as user n4sadm. First of all, since NW07 SR3 remove the environment variable DB2DB6EKEY, we need to regenerate the user password file as below:
n4shost:n4sadm 65> dscdb6up -create passw0rd passw0rd password file '/usr/sap/N4S/SYS/global/dscdb6.conf' successfully written
Because the additional partition will need to use additional resource (CPU and memory), you might notice that the SAP system becomes slower than before.
Page 19
the following result returned, which means all 13640 records in this fact table are located in partition 0.
----------- ----------0 13640 1 record(s) selected.
Goto DBACockpit -> Wizards -> BI Data Distribution, click continue to begin. 1. Add partition 1 to the NGRP_FACT_NEW partition group and click continue. 2. Accept the default location for the temporary tablespace and click continue again. 3. Check Start Immediately, and then click continue. 4. Review the redistribution procedure summary and then click execute to start the redistribution process. This will run the script to create a system temporary tablespace container on the new partition, add the new partition into the partition group, and then redistribute the data to all existing and new partitions. You can go to Jobs -> DBA Log or SM37 to view the job log. After the job is completed successfully, check the new data distribution. Goto DBACockpit -> Diagnostics -> SQL Commands, enter the following SELECT statement:
select dbpartitionnum(key_zsd_c02p) as partitionnum, count(*) from "/BIC/FZSD_C02" group by dbpartitionnum(key_zsd_c02p)
Page 20
3.17 Remove the newly added partition from the partition group
The following steps show how to remove a partition. Before we can remove the partition 1, we have to move the data located in partition 1 to other partitions. For this, we can use the BI Data Distribution wizard again, to remove partition 1 from the partition group NGRP_FACT_NEW.
3.18 Redistribute the data back across the remaining partitions in the partition group
Click the Yellow up-arrow to exit the dbacockpit completely, and then return back into the dbacockpit, to the BI Data Distribution Wizard, click continue 1. remove the partition 1 from the NGRP_FACT_NEW partition group 2. accept the defaults on the next two screens and just click continue. 3. check Start Immediate, and then click continue one last time. You can go to Jobs -> DBA Log or SM37 to view the job log. You can now verify the data has been redistributed back to partition 0 only. Goto DBACockpit -> Diagnostics -> SQL Commands, enter the following SELECT statement:
n4shost:1> select dbpartitionnum(key_zsd_c02p) as partitionnum, count(*) from "/BIC/FZSD_C02" group by dbpartitionnum(key_zsd_c02p) ----------- ----------0 13640 1 record(s) selected.
Dropping the partition from the database manager cannot be done from within SAP. Once the preceding redistribute finishes, logon to n4shost as db2n4s, and run the following command to verify which partitions are still in use by the database: db2 drop dbpartitionnum verify Since you have previously removed your new partition from all partition groups and redistributed the data off of that partition, you should not see your new partition in this list. Completely logoff of SAP GUI, and run stopsap as n4sadm to stop SAP on the server. This prevents the SAP work processes from reconnecting to the database and causing problems while DB2 is dropping the partition. Then, switch to the db2n4s userid, and run the following command, to drop the partition from the database manager: db2stop drop dbpartitionnum 1 Again, cat /db2/db2n4s/sqllib/db2nodes.cfg, to verify that the partition has been removed, and then run startsap as the n4sadm userid, to restart SAP and DB2.
3.20 Confirm the partition removal and data distribution, and restart sap
Page 21
Unit 4 BI Query Analysis In DBACockpit -> Performance -> SQL Cache, Set Selection Criteria Average Execution Time >= 1000 ms, Sort statements by Avg. Execution Time, pick an expensive statement and click on Ex4.1 Query plain button to display its access plan. Analysis in DBACockpit How is table accessed, by table scan or index access? Whats the estimated total cost? Run transaction RSRT, enter Query Name ZSD_C01/BENCHMARK_QUERY_2, click on Execute + Debug, check flags Do not use cache and Display statistics data (under Others section), hit Continue button. After the query results are displayed press Back button in the toolbar of the result window, the runtime statistics of the query is displayed.
Question: how much time was spent in the database (Data Manager) and how much time was spent in the SAP Application Server (total time spent on all OLAP events)?
Write down the Duration of Data Manager to the Work Sheet on the final page of this hand book.
Run transaction RSRT, enter Query Name ZSD_C01/BENCHMARK_QUERY_2, click on Execute + Debug, 4.3 Check SQL Trace and access plan check flags Display SQL/BIA Query (under Data Manager section), hit Continue button. Firstly you will see the SQL statement display window, review the SQL statement.
Page 22
From the above SQL statement, you can tell it is selecting data from F fact table joined with dimension tables for dimension T, U, 13 (sales org) and P where CALMONTH is between 200001 and 200012 and SALESORG is equal to 83, returning summarized column INCORDVAL (total incoming order value), INVCD_QTY (total invoiced quantity) and INVCD_VAL (total invoiced value) that are grouped by sales division and calendar year/month.
Page 23
Questions: 1. what are the local conditions applied to this table? What selectivity can you get when applying these conditions on this table? 2. how many number of rows in this table? 3. whats the estimated number of output rows? 4. what condition is used to join this table with the fact table?
Open another SAP GUI window and activate ST05 SQL trace; then click on back button on the tool bar of SQL screen to complete the query execution; deactivate ST05 trace. Display ST05 SQL Trace, locate the SQL-Statements that correspond to the query in the RSRT SQL window (obj. name = /BIC/FZSD_C01). Explain this SQL statements from within the ST05 trace (move the cursor on the statement text first, then click on Explain button)
Page 24
On the Display Execution Plan for SQL Statement window, you get the access plan. Click on the Tree Info button, you will see the number of rows returned, total cost and I/O cost of each operation. Questions: 1. What is the name of the fact table? 2. Which dimension table is joined firstly to the fact table, what type of join? 3. What method is used to access the fact table? If it is an index access, what is the index being used? 4. What is the total cost of this access plan? 5. How many rows will be returned by this query according to the access plan?
Another way to check the query access plan, without using ST05 trace, is to check DB2 SQL cache (Package cache) directly.
Page 25
In another SAP GUI window, go to DBACockpit -> Performance -> SQL Cache. On the Selection Criteria window, remove 100 from the Executions field, and enter the SELECT*FZSD_C01* in the SQL Text field. The following statement execution result is returned:
Write down the Avg. Execution time, Buffer Quality, Rows Read, SQL Sorts and the total Estimated Costs to the Work Sheet on the final page of this hand book.
*Note* For more accurate comparison, especially to demonstrate the disk I/O cost saving by using MDC feature in the next exercise, you need to run the query in a cold buffer pool, which means the table data should not have been cached in the buffer pool. This will require comparing the result on the first query execution on a newly started system. Therefore you might want to stop and restart your SAP system before running the query. Double click on the statement, or click on Explain button, you will get the access plan of this statement. In the case of query performance problem, and you want to open an SAP OSS message, you need to collect related diagnostics data for this query. On the Display Execution Plan screen, click on Collect button, which will allow you to download query related data, such as database configuration parameters, table and index definitions and statistics, detailed access plan, etc. into respective files.
Page 26
Save SQL statement in a text file. From the Execution Plan screen, you can click on Edit button, which will open a Edit SQL Statement window, you could use one of the following ways to create a statement text file on the database : a. select the entire statement text, hit CTRL+C to copy the text to the clipboard, then on the DB2 command window (in user db2n4s) on the database server, use vi editor to create a file query2.sql, paste the statement text to vi, add an ; at the end of the statement, and save this file; b. you can save the file locally by using the Save as local file button. Then move the file from local to the database server in a directory that can be accessed by user db2n4s (e.g. /db2/N4S/db2dump). You also need to edit the file by adding ; at the end.
2.
On the database server, in the db2n4s command window, enter the following command:
Once the db2support.zip file is generated, download it to the local server, and check what data has been collected.
Page 27
Page 28
Unit 5 MDC for SAP BW Run transaction RSA1: Modelling click InfoCube Benchmarkcube InfoProvider Select benchmark RightAdditional Functions Reclustering
5.2 Confirm that a recent backup was done before activating the changes
The system is asking if a database backup was done. You must answer the pop-up with Yes. Otherwise, you cannot activate the changes. Reclustering entails copying data from the original table into a shadow MDC table. Therefore a valid backup before the changes is required. In this exercise, we will skip the database backup.
Confirm selection
Page 29
The default setting for the number of MDC columns is 3. If you select more than three columns (excluding Package Dimension), the system displays an error pop-up. Choosing too many columns will probably result in many half empty MDC cells allocated. By default, the time dimension SID_0CALMONTH is automatically selected as the first MDC dimension. Check Package Dimension on F Fact Table. A dimension on Package number will help to improve BW compression function. Also enter 2 on line ZSD_C013 Sales Area to define it as the second MDC dimension. Check Execute Space Check.
5.5 Choose MDC dimension columns among InfoCube dimension columns, and define the sequence number of MDC dimension
Click Continue button, and receive the following space check result:
Page 30
The Space Check result is displayed in red colour, which means over 50% (Number of free pages 159180 / Number of pages that can be allocated 318360) of table space will be wasted. Further looking at the result, you see that the Number of different values in MDC dimension KEY_ZSD_C013 (Sales Area) is 64203, which is too great, compared to the other two MDC dimension columns on Package Dimension (12) and CALMONTH (132). Therefore Sales Area is not a good candidate for MDC dimension, and we need to remove the second MDC dimension on Sales Area. Click on Cancel button, go back to previous MDC definition screen, remove 2 from the line Sales Area, and leave Package Dimension and Calendar Month as MDC dimension columns. Click Continue button again, and display the new space check result:
Page 31
Start re-cluster job in background. Select Immediate options for the background job, then click Save icon. Going back to Reclustering of InfoProviders screen, click on Monitor button. On the Monitor Requests screen, click on Refresh button until you see the status becomes green.
You can also use SM37 to check the background job status. Run transaction SE14. Enter table name: /BIC/FZSD_C01 5.8 Check storage parameter Edit
To check the table structure use button Storage Parameter. The clause Organize by Dimensions is used to define a MDC dimension. In this case, two MDC dimensions are defined: KEY_ZSD_C01P and SID_0CALMONTH.
Page 32
Write down the Total Table Size, Total Index Size and No. of Pages with Data to the Work Sheet on the final page of this hand book.
Comparison of the table size before and after the table is converted to MDC. You should notice that the total table size has increased, and in the mean time, the total index size has decreased because of using block index.
Page 33
All MDC block indexes are generated by the system and therefore start with SQL<number>. The index name generated on your system might differ. All regular RID indexes are user defined and follow the SAP naming convention for indexes: <Table Name>~<INDEX-NUMBER>, e.g. /BIC/FZSD_C01~020. Run transaction RSRT, enter Query Name ZSD_C01/BENCHMARK_QUERY_2, click on Execute + Debug, check flags Do not use cache and Display statistics data (under Others section), hit Continue button. After the query results are displayed press Back button in the toolbar of the result window, the runtime statistics of the query is displayed. 5.10 Run BI query again and verify the performance improvement after the fact table is converted to MDC. Comparing the result to 4.2
Question: how much time is spent in the database (Data Manager) this time?
Write down the Duration of Data Manager to the Work Sheet on the final page of this hand book.
In another SAP GUI window, go to DBACockpit -> Performance -> SQL Cache. On the Selection Criteria window, remove 100 from the Execution field, and enter the SELECT*FZSD_C01* in the SQL Text field. The following statement execution result is returned:
Page 34
Questions: 1. What method is used to access the fact table? If it is an index access, what is the index being used? Hint now it is using MDC block index based on CALMONTH dimension column. Which dimension table is joined firstly to the fact table, what type of join? What is the total cost of this access plan? Compared this cost with the result from the exercise 4.3.
2. 3.
Write down the Avg. Execution time, Buffer Quality, Rows Read, SQL Sorts and the total Estimated Costs to the Work Sheet on the final page of this hand book.
*Note* For more accurate comparison, especially to demonstrate the disk I/O cost saving by using MDC feature, you need to run the query in a cold buffer pool, which means the table data should not have been cached in the buffer pool. This will require comparing the result on the first query run on a newly started system. Therefore you might want to stop and restart your SAP system before running the query. As you can tell, the query time is much faster after the fact table has been converted to MDC table. And the access plan indicates that the block index defined on
Page 35
Run transaction SE16 - Data Browser Browse table: RSADMIN Restrict values in field OBJECT to DB6*
Entries starting with DB6 are DB2 for LUW related. The following entries control MDC settings: 1 DB6_MDC_FOR_PSA = YES/NO default NO 2 DB6_MDC_FOR_AGGREGATES = YES/NO default YES
Page 36
Unit 6 Deep Compression for SAP BW Run transaction RSRV: On the Analysis and Repair of BI Objects screen, expand Tests in Transaction RSRV All Elemetary Tests Database Double-click Data row compression of InfoProviders. to select the test. Double click on the row in the right side of the screen. A pop-up will appear.
Select the InfoProvider you want to test ZSD_C01 and click Transfer. 6.2 Select the InfoProvider you want to check
Expand the row in the right side of the screen, high light the line InfoProvider=ZSD_C01, execute the test by pressing button Execute.
Page 37
The result shows the compression feature is NOT enabled for the F fact and E fact tables of InfoCube ZSA_C01, and the F fact table size is 32.78MB.
Run transaction DBACockpit, go to Space /BIC/FZSD_C01 and hit Enter. 6.5 Estimate Compression Ratio
Select the tab Compression Status. It shows that this fact table is not enabled for compression.
Page 38
Click Compression Check button, on the following screen, click on Execute button. Note: since this is a small table, it is OK to choose Run in Dialog. If it is a large table, it is better to run in a background job.
When it finishes, click on Refresh button, and the compression check result is shown: It is estimated that 66% of pages will be saved.
Page 39
Click on Compression On/Off button, on the following screen, choose Enable Compression and Run REORG, click Execute button.
Page 40
Flip to the tab Table, you will see the new table size is now 12864K.
Write down the Total Table Size, Total Index Size and No. of Pages with Data to the Work Sheet on the final page of this hand book.
You should notice that the table size and the No. of Pages with Data have decreased significantly.
Page 41
Question: how much time is spent in the database (Data Manager) this time?
Write down the Duration of Data Manager to the Work Sheet on the final page of this hand book.
In another SAP GUI window, go to DBACockpit -> Performance -> SQL Cache. On the Selection Criteria window, remove 100 from the Execution field, and enter the SELECT*FZSD_C01* in the SQL Text field. The following statement execution result is returned:
Double click on the statement, or click on the Explain button, you can get the access plan. Compare this access plan with the access plan you saw in exercise 5.11. They should be the same, except that the total estimated costs are different because of disk I/O cost saving on the compressed fact table.
Write down the Avg. Execution time, Buffer Quality, Rows Read, SQL Sorts and the total Estimated Costs to the Work Sheet on the final page of this hand book.
*Note* For more accurate comparison, especially to demonstrate the disk I/O cost saving by using MDC feature or compression feature, you need to run the query in a cold buffer pool, which means the table data should not have been cached in the buffer pool. This will require comparing the result on the first query run on a newly
Page 42
Run transaction SE16 - Data Browser Browse table: RSADMIN Restrict values in field OBJECT to DB6*. You will see now DB6_ROW_COMPRESSION is set to YES.
Page 43
Unit 7 BI Operations Before starting the BI compression, lets check the total number of records in F fact table and E fact table of InfoCube ZSD_C01. How to do that? Hint use DBACockpit Single Table Analysis function. Results: F fact should contain 160600 records, and E fact table contains 0 records. Now move to DW Workbench screen. Lets check how many records was loaded in the request 14. Run transaction RSA1 Modeling InfoProvider Select benchmark Select Benchmarkcube and right-click Select Manage Select Requests tab.
Click on the Monitor icon on the line of request 14. You should see the detailed information of request 14. Click on Details tab, and expand Extraction and Transfer menu: You can see that there are 13640 records being extracted from the source file. Data was loaded in the package size of 1000. There were 14 data packages were created and loaded in BW.
Page 44
Page 45
When the job is finished, go back to Requests tab, and click on Refresh button, you should see a check mark in the third column (Compression Status in InfoCube) on the line of Request 14.
Page 46
Go to the DBACockpit Single Table Analysis, Enter table name /BIC/FZSD_C01, do a RUNSTATS in dialog. When the runstats finishes, you should see the table cardinality is changed from 160.600 to 146.960, which means 13640 records has been deleted in F fact table. Now check table /BIC/EZSD_C01. You should see its cardinality is 13640, which means 13640 records has been inserted into E fact table. Go to the ST05 screen and deactivate the trace. Display the trace. You should be able to find the following statements in the Trace List screen:
The above INSERT and DELETE statements are key statements to this InfoCube compression process. Move the cursor to the INSERT statement, and click on Explain button. You will see the full statement text and the access plan:
Page 47
Try to understand this SQL statement. This is a INSERTSELECT statement. It basically select records from F fact table based on the request ID and insert these records into E fact table. Question: what index is used to select records from F fact table? Answer: a MDC block index on Package dimension. Shown below:
Go back to Trace List screen, move the cursor to the DELETE statement, and click on Explain button. You will see the full statement text and the access plan:
Page 48
Run program SAP_RSADMIN_MAINTAIN in transaction SA38. Enter DB6_MDC_FOR_AGGREGATES in the OBJECT field, and YES in the VALUE field, choose INSERT, then click on Execute button.
After this, you can run SE16 to display this parameter in table RSADMIN. 7.4 Create an aggregate
Page 49
Click on Aggregates button to maintain aggregates of this InfoCube. On the following screen, click on Create by Yourself button.
On the Maintenance for Aggregate screen, Click on the Create New Aggregate button. Enter the aggregate description as below:
and hit Enter. Drag Sales Area dimension and Time dimension from the left window onto the newly cre-
Page 50
Click on the Save button at the top of the window to save the aggregate definition. Then click on the Activate and Fill button. Click on Start button, and choose Immediately on the pop-up message box:
Click on the Jobs button and you will be directed to the Job Overview screen. On the Job
Page 51
Page 52
Page 53
Since now we have the aggregate defined on both SALES AREA and TIME dimension, the original query we have run should select data from the aggregate rather than from the infocube. We can verify this by running the query again. Run transaction RSRT, enter Query Name ZSD_C01/BENCHMARK_QUERY_2, click on Execute + Debug, 7.6 Run BI query again check flags Display SQL/BIA Query (under Data Manager section), hit Continue button. Now you will see the SELECT statement that selects from the aggregate E fact table /BIC/E100004. click on the Back button then this query will be executed and the query result will be displayed.
Page 54
Page 55
Work Sheet Default table (no MDC) Total Table size Fact table Size Comparison Total Index size No. of Pages with Data MDC table Compressed MDC table
Default table (no MDC) RSRT Data Manager Duration Avg. Execution Time (ms) Rows Read Buffer Quality SQL Sorts Access Plan Estimated Costs (timerons)
MDC table
Page 56