If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > EXPLAIN output ...... Confusing ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-15-04, 14:07
pm_dba pm_dba is offline
Registered User
 
Join Date: Jun 2004
Location: Bangalore
Posts: 12
Angry EXPLAIN output ...... Confusing ?

When EXPLAIN'd Matched colums = 0 for a table with index defined on the columns used in the SQL.

I am not sure What could be the reason for it ? could somebody help me out ?

Regards,
pm
Attached Files
File Type: doc sql.doc (15.3 KB, 68 views)
Reply With Quote
  #2 (permalink)  
Old 06-15-04, 14:58
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Note: Please list your DB2 version and Operating System in future posts. (DB2 for OS/390 version ?).

Matching columns is the number of leading columns in an index supplied in a predicate (WHERE clause).

For example with one composite index on (col1, col2) and the following SQL, the number of matching columns is as follows (assuming that DB2 uses the index).

matching columns = 0
Code:
select * from table_name where col2 = ?
matching columns = 1
Code:
select * from table_name where col1 = ?
matching columns = 2
Code:
select * from table_name where col1 = ? and col2 = ?
When matching columns is zero, DB2 reads the entire index from top to bottom (all of the leaf pages) sort of like a tablespace scan, but on the index. When matching columns is 1 or greater, DB2 uses the b-tree structure of the index to get to the index leaf pages needed.

The matching columns 0 in your example appears to be in a join with mutilple access paths needed. It may, or may not be, a problem depending on a number of factors.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On