What is an EXPLAIN in DB2.
How and what is the steps followed in EXPLAIN command. Can
all the queries be used in EXPLAIN command to check the
performance.

Answers were Sorted based on User's Feedback



What is an EXPLAIN in DB2. How and what is the steps followed in EXPLAIN command. Can all the quer..

Answer / yuvaevergreen

>>Explain can be used to improve the performance of queries.
>>Explain command populates three tables
PLAN_TABLE,DSN_STATEMNT_TABLE,DSN_FUNCTION_TABLE. These
tables contains various info about the queries which can be
used for improving the performance.
>>Step1:PLAN_TABLE must be created.
>>Step2:Use explain sql or explain option in Bind to
populate the tables.
>>For example,explain plan set queryno=01 for select empname
from employee;
This would populate plan and statement table.Assigned
queryno would be 01.
>>Alternately EXPLAIN(YES) in BIND option.
>>Only select,insert,update,select for update,delete, delete
current of cursor,update current of cursor can be used in
explain.

Is This Answer Correct ?    7 Yes 0 No

What is an EXPLAIN in DB2. How and what is the steps followed in EXPLAIN command. Can all the quer..

Answer / s.v.venkata sivaprasad

explain is the db2 tool which used to improve db2
performance and provides best access path to package

Is This Answer Correct ?    1 Yes 0 No

What is an EXPLAIN in DB2. How and what is the steps followed in EXPLAIN command. Can all the quer..

Answer / ryan

Whenever we run a query,DB2 creates an access plan that specifies how it will access the requested data. This is created whenever the sql is compiled at bind time for static sql and before execution for dynamic sql.
DB2 bases the access paths on the SQL statements and also on the statistics and configuration parameters of the system.
Even when an sql is made efficient, it can become inefficient as data grows. So, we need to run DB2 runstats  so as to keep updated statistics . DB2 config and storage can change and plans can be rebound. Db2 explain gives us the info for the plan, package, or SQL statement when it is bound. The output of the EXPLAIN  is stored in user-created table called plan table. Whenever we want to tune a query, we need to go and check the plan table so as to get an idea of the access path DB2 optimizer is using.
http://mframes.blogspot.in/2015/01/db2-explain-and-plan-table-column-names.html

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

Can one database have multiple instances?

0 Answers  


Could you please let me no the query for below I have table name xyx under this there is column name called employee name which starts from 100th column ends 120th column,now i want to replace only column from 101 to 104 which contains ABCS to replace with PQRS for all records which comes beetween 101 to 104 ..how to write query for this..

1 Answers   HSBC,


have 3 tables table1, table2 and table3 which contains employee information. table1 is master table, table2 contains emp details like emp no and so on, table 3 contains emp salary. so if any emp leave company between 25th - 30th of every month it has to get updated in tables. but it is not getting updated. What is the reason.

0 Answers  


Hi i need to write a query on the following requirement. SELECT COMM_TEXT INTO :WS_MIKM_COMM_TEXT FROM MPIPROD.MIKMV01 WHERE ACCOUNT_NO = :WFD_ACCOUNT_NO AND (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT AND SUBSTR(COMM_TEXT,47,14) = :WS_DENY_DESC) OR (SUBSTR(COMM_TEXT,1,39) = :WS_COMMENT_TEXT) The above query is to be modified. The requirement is if both the fields are equal then that has to be given priority. In the above query if it satisfies any one it comes out without checking if both being equal is possible.

1 Answers  


What is precompiler in db2?

0 Answers  






Is DECLARE TABLE in DCLGEN necessary? Why it used?

3 Answers  


What is DYNSLT keyword? How do you perform selection using DYNSLT

1 Answers  


how can you save the query in QMF?IS IT POSSIBLE OR NOT.IF POSSIBLW HOW?

1 Answers   Hewitt,


What is load utility in db2?

0 Answers  


how to resolve -818 error. how to see timestamp token in load module and plan

4 Answers   IBM,


How many sub queries can you combine together ?

4 Answers   IBM,


How to check table size in db2 sap?

0 Answers  


Categories