Temp-tables

Posted by ankitshukla on 14-May-2015 04:57

I have 100 lacs (1 crore) ' s of records in my temp-table. I wanted to empty my temp-table which one is faster and why

for each tt:
delete tt.
end.  

or

Empty temp-table tt.

I am using open edge 11.4.

All Replies

Posted by Mike Fechner on 14-May-2015 05:08

100 lacs? Would that be like millions of records or so?
Why would you want to have so many records in a temp-table anyway? That is crazy! A temp-table is not meant to copy a DB into …
 
Von: ankitshukla [mailto:bounce-ankitshukla@community.progress.com]
Gesendet: Donnerstag, 14. Mai 2015 11:58
An: TU.OE.General@community.progress.com
Betreff: [Technical Users - OE General] Temp-tables
 
Thread created by ankitshukla

I have 100 lacs (1 crore) ' s of records in my temp-table. I wanted to empty my temp-table which one is faster and why

for each tt:
delete tt.
end.  

or

Empty temp-table tt.

I am using open edge 11.4.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by ankitshukla on 14-May-2015 05:14

No I was not actually copying the DB records into temp-table. I was taking those records from a text file.

Posted by Mike Fechner on 14-May-2015 05:20

But we are talking about millions of records? How large did your dbi file grow?
 
The fastest way to get rid of the temp-table is to exist the program/delete the class that defined it.
 
Followed by EMPTY TEMP-TABLE.
 
For such large amounts of records keeping them in a local DB and deleting the DB when no longer needed will be much faster. Local DB’s and temptables are comparable in Performance (once the TT get’s too large for –Bt).
Von: ankitshukla [mailto:bounce-ankitshukla@community.progress.com]
Gesendet: Donnerstag, 14. Mai 2015 12:15
An: TU.OE.General@community.progress.com
Betreff: RE: [Technical Users - OE General] Temp-tables
 
Reply by ankitshukla

No I was not actually copying the DB records into temp-table. I was taking those records from a text file.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by Libor Laubacher on 14-May-2015 05:20

Either way, use ETIME to measure it, you have the records there J
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Thursday, May 14, 2015 12:09 PM
To: TU.OE.General@community.progress.com
Subject: [Technical Users - OE General] AW: Temp-tables
 
Reply by Mike Fechner
100 lacs? Would that be like millions of records or so?
Why would you want to have so many records in a temp-table anyway? That is crazy! A temp-table is not meant to copy a DB into …
 
Von: ankitshukla [mailto:bounce-ankitshukla@community.progress.com]
Gesendet: Donnerstag, 14. Mai 2015 11:58
An: TU.OE.General@community.progress.com
Betreff: [Technical Users - OE General] Temp-tables
 
Thread created by ankitshukla

I have 100 lacs (1 crore) ' s of records in my temp-table. I wanted to empty my temp-table which one is faster and why

for each tt:
delete tt.
end.  

or

Empty temp-table tt.

I am using open edge 11.4.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Dileep Dasa on 14-May-2015 05:20

DELETE deletes the records individually whereas EMPTY TEMP-TABLE deletes all records in the temp-table as a unit. Hence, EMPTY TEMP-TABLE should be faster.

Posted by ankitshukla on 14-May-2015 06:14

My database files are growing till 2gb. but I am not a database expert. so not having much knowledge about database files. like d1,d2...etc.............I am just asking it for programming purpose.

Posted by Fernando Souza on 14-May-2015 08:30

Returning/deleting (if class, persistent procedure) the procedure that defines the temp-table is faster.

EMPTY TEMP-TABLE when there is no active transaction, or anytime for a NO-UNDO temp-table is just as fast. Otherwise, it's comparable to FOR EACH: DELETE.

Posted by TheMadDBA on 14-May-2015 10:06

You almost never need to have that many records in a temp-table at one time. If you do then most likely something is wrong. Worst case when importing from a file you should be batching the temp-table load and then writing to the DB and emptying the temp-table.

All that being said.... If you make sure your -Bt is set high enough to keep all of the temp-table records in memory and use EMPTY TEMP-TABLE it should happen pretty fast.

This thread is closed