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 > Federated link query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-13-08, 16:02
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
Federated link query

I am using a select stmt to "select" one of the field (say x) of a federated link table based on match of another single field ( say y )

Its taking 15 sec for execution which is too much.
optimization possible?
__________________
*** Prem ***
Oracle Certified Associate - SQL & PL/SQL
Reply With Quote
  #2 (permalink)  
Old 11-13-08, 16:47
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Standard SQL and DB2 doesn't know anything about "fields" and "federated link tables". Do you mean "columns" and "nicknames"? If so, it would be helpful to know the exact statement you are using, some information on the schema (indexes and the like), and also the usual information about which DB2 system you are using on which platform.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 11-13-08, 16:56
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
I am using DB2 v 8.
__________________
*** Prem ***
Oracle Certified Associate - SQL & PL/SQL

Last edited by prem18; 11-18-08 at 13:33.
Reply With Quote
  #4 (permalink)  
Old 11-13-08, 17:06
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
What's the access plan for the statement? In there, you will also see the query that is shipped to the remote server. Are there sufficient indexes on the remote server to support that query?

How many results do you get back? Maybe there are 1 billion qualifying rows, so that it just takes time to shuffle them over the network wire...
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 11-14-08, 09:36
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
I can run access plan . Since I am not sure with what details are required for you, I am waiting for your reply so that I can get you what information you need
Thanks
__________________
*** Prem ***
Oracle Certified Associate - SQL & PL/SQL
Reply With Quote
  #6 (permalink)  
Old 11-14-08, 17:08
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Sorry, I don't understand your question. The only thing you have to do is take your query and produce the explain output/access plan for it.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #7 (permalink)  
Old 11-17-08, 14:01
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
There are sufficient indexes on the table. Not sure what would be the bottleneck
__________________
*** Prem ***
Oracle Certified Associate - SQL & PL/SQL
Reply With Quote
  #8 (permalink)  
Old 11-18-08, 05:10
tibullo tibullo is offline
Registered User
 
Join Date: Dec 2004
Location: Italy
Posts: 32
Prem, check the runstats you did on the object...

... are the stats all right?
Reply With Quote
  #9 (permalink)  
Old 11-18-08, 07:58
umayer umayer is offline
Registered User
 
Join Date: Dec 2005
Posts: 273
Code:
AND CURRENT DATE BETWEEN PTPR_PRICE_START AND PTPR_PRICE_END
that is not indexable. Rewrite it to

Code:
AND PTPR_PRICE_START <= CURRENT DATE
AND PTPR_PRICE_END >= CURRENT DATE
Reply With Quote
  #10 (permalink)  
Old 11-18-08, 13:20
prem18 prem18 is offline
Registered User
 
Join Date: Apr 2007
Posts: 51
Thumbs up

Finally i got it..!!
For validation purposes,I declared the variable var1 as varchar(100) instead of database field type varchar(7). When I matched the size with the database field size, the query executes in no second..!! and this resolved my issue!
Anyways Thanks so much for helpful suggestions
__________________
*** Prem ***
Oracle Certified Associate - SQL & PL/SQL
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