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 > Recursive Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-24-05, 15:15
rhayabusa rhayabusa is offline
Registered User
 
Join Date: Feb 2005
Posts: 21
Recursive Query

Are there any downfalls in using recursive queries. Also, if a temp table created by a recursive query is larger than the allocated space, can it cause the database to crash?

With
Table1 As(Select ...)

Select ... from Table1;
Reply With Quote
  #2 (permalink)  
Old 02-24-05, 15:58
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
1. What you quote in your message is not a recursive query.
2. Common table expression (the "WITH" part) does not necessarily create a temporary table.
3. If the database manager runs out of temporary space it shouldn't crash. However, the query itself will fail. Other queries may also fail if they use the temporary space as well.

Last edited by n_i; 02-24-05 at 16:07.
Reply With Quote
  #3 (permalink)  
Old 02-24-05, 16:03
rhayabusa rhayabusa is offline
Registered User
 
Join Date: Feb 2005
Posts: 21
Thumbs up

Thanks a lot. I thought a common table expression always created a temp table for the duration of the select.
Reply With Quote
  #4 (permalink)  
Old 02-24-05, 16:10
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
You can always look at the execution plan to see whether any particular query does it or not.
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