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 > SQL problem: optimizing UNION operator

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-04, 05:07
AStefan AStefan is offline
Registered User
 
Join Date: Jun 2004
Posts: 57
SQL problem: optimizing UNION operator

Hello!
My application's search is based on some queries grouped through union or intersect operator.
My problem is that I would like to optimize the search and I cannot optimize UNION or INTERSECT operator.
If I add the times of all the queries I get a number infinitely small than the time obtain by the reunion or intersection of these queries.
For example, if I have:
select 1
union (intersect)
select 2
union (intersect)
select 3
etc.

If I add the select1, 2, 3 etc. response time I will get a very small result comparing with the union (Intersect) result time. I cannot use union all because I need to eliminate the duplicates.
Can you give me an advice regarding this optimizing problem?
Thanks in advanced.
Reply With Quote
  #2 (permalink)  
Old 11-08-04, 05:49
xamar xamar is offline
Registered User
 
Join Date: Apr 2004
Posts: 39
Re

Stefan,

Removal of duplicates could be taking sometime but may not be taking so long. Why don't you check the individual access path and the combined access path using EXPLAIN? It might give some clue. Besides the volume of data being handled could have some information.

xamar
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