Is it OK to issue asynchronous commits on TEMPORARY tables? Does it make my transactions less durable?
CREATE GLOBAL TEMPORARY TABLE my_table_tmp (id number) ON COMMIT PRESERVE ROWS;
CREATE TABLE my_table (id number);
BEGIN
INSERT --+ append
INTO my_table_tmp (id)
SELECT rownum
FROM all_objects;
COMMIT WRITE BATCH NOWAIT; -- continue working without waiting on LGWR
INSERT INTO my_table (id)
SELECT id
FROM my_table_tmp;
COMMIT; -- actually preserve transaction
END;
/
Edit:
Yes, I understand that it is not strictly ACID because it bypasses the D part for a split second. The question is - is it "as good as" ACID because there is no possible scenario where it is different from the version where only real COMMITs are used? Or am I mistaken and there can be a difference?
In a word: no. The D in ACID stands for Durability, which means that a commit 100% guarantees that the transaction is preserved even if the database should crash immediately after. An asynchronous commit provides a window of opportunity for this aspect of ACID to be violated.
More information on the advantages/disadvantages of using asynchronous commit is here: http://www.orafaq.com/node/93