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 > db2advis and explain options

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-07, 16:17
savethytrees savethytrees is offline
Registered User
 
Join Date: Dec 2006
Posts: 25
db2advis and explain options

Hi,
Is there a way that I can simulate an index and explain the SQL to get the access plan if the index actually existed?
What I want to do is use db2advis and get a recommendation to create and index. Then do an explain on the SQL, as if the index exists. I don't want to create the index and then do the explain to see the effects of creating the index.
Reply With Quote
  #2 (permalink)  
Old 01-22-07, 02:36
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
No, you have to create the index.
But you may use the "DEFER YES" option to the "CREATE INDEX" statement to avoid the overhead of actually physically building the index. (At least, on z/OS; I don't know if this is possible on other platforms.)
Just drop the index after having run EXPLAIN.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #3 (permalink)  
Old 01-22-07, 03:55
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
Hi,
DEFER YES is not supported on DB2 for Linux/Unix/Windows. But in create index documentation there is a statement:
Code:
For compatibility with DB2 for OS/390:
  o The following syntax is accepted as the default behavior:
  DEFER NO
Savethytrees, what is your operating system and version?

Hope this helps,
Grofaty
Reply With Quote
  #4 (permalink)  
Old 01-24-07, 13:56
savethytrees savethytrees is offline
Registered User
 
Join Date: Dec 2006
Posts: 25
Sorry for not giving that basic info.
Its DB2 ESE V8.2 FP4 AIX 5.3.
There is a way by which we can get recommended indexes for a given SQL while doing explian. This reduces the need to do a db2advise everytime you think there might be a problem and index is required. You run the explain and the Adives_index table is populated for the given SQL.
But I cannot figure out if there is a way to get the access plan which includes the index that doesn't exists.
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