bhuvaneshwari
28th May 2009, 08:57
A new blog entry has been added:

Delete Millions Of Records with Less Time and Performance

Hi,
We have a session which is used to delete the rows in the table. It has 5 sections and each sections takes more time to delete the Millions of records and are executed one by one . And now we need to delete all the records in less time.
Any suggestion on what could be done delete the records with less time will be very much help full for us.
 
Thanks,
Bhuman 

bdittmar
29th May 2009, 12:30
A new blog entry has been added:

Delete Millions Of Records with Less Time and Performance

Hello,

db.clear.table()

--------------------------------------------------------------------------------

Syntax
long db.clear.table( long table_id [, long flag [, long comp_nr]] )
Description
This deletes all data from a specified table. Reference counters are automatically updated.

By default, all deleted records are saved in rollback segments. Consequently, using this function to clear a large table can result in reduced performance and, in some cases, can cause overflow of the internal rollback segments.

Arguments
table_id
The table ID, as returned by db.bind().

flag Use this optional argument to indicate whether the delete operation must be performed as a single transaction or as multiple transactions. The possible values are:

0 WITH.ROLLBACK
The table is cleared in a single transaction. All records are saved in rollback segments. This is the default option.

1 NO.ROLLBACK
The table is cleared in one or more transactions, depending on the number of records in the table. Each transaction is automatically committed after 20 records have been deleted. The number of records deleted in the final transaction can be 20 or less; this depends on how many records remain to be deleted.

When you use this option, transactions are small and records are not saved in rollback segments.

When you use this option, you must place db.clear.table() at the start of the transaction.


comp_nr
This optional argument specifies a company number for the table. The default company is the company of the user.


Return values
0 success
<>0 error