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 > declare temp tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-11, 16:35
redwolf redwolf is offline
Registered User
 
Join Date: Apr 2004
Posts: 179
declare temp tables

When a temp table is declared with not logging, the dml will not be logged in the transaction logs. However, the creation and dropping of the temp table will. This sound like the declare clause begins a transaction. My question is will a commit end the transaction or does it have to be a drop table statement? I know ending the connection or application will also end the transaction and drop the temp table.

Thanks
Reply With Quote
  #2 (permalink)  
Old 06-22-11, 16:44
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Temp tables stay around until either they are explicitly dropped (DROP TABLE SESSION.x) or the connection is terminated.

Andy
Reply With Quote
  #3 (permalink)  
Old 06-23-11, 05:35
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Transactions are always ended by a COMMIT or ROLLBACK - nothing else. Both operations can occur implicitly (auto-commit or terminating a connection, which triggers an implicit ROLLBACK).

And as Andy said, the existence of a temp table is tied to the connection (not the transaction).
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 06-24-11, 16:07
redwolf redwolf is offline
Registered User
 
Join Date: Apr 2004
Posts: 179
I have two scenarios below. Which one(s) will caused a transaction full issue.

1. User runs an app which declares a temp table, but does not do a commit or drop table in its code. The user leaves the app open over night. There is enough activity from other apps to fill all the transaction logs. Will this result in a transaction full issue.

2. User runs an app which declares a temp table, but does a commit but not a drop table in its code before returning the result set to the user. The user leaves the app open over night. There is enough activity from other apps to fill all the transaction logs. Will this result in a transaction full issue.


Thanks
Reply With Quote
  #5 (permalink)  
Old 06-24-11, 16:16
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Filling up the transaction log is not dependent on whether you use temp tables or not. You will fill up the log by having enough open transactions performing work to fill them up. This can occur with just one transaction if it is large enough. Transactions left open for long periods of time will definitely lead to filling up the transaction log.

Andy
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