|
The test runs 10000 iterations and ends up with 380'000 characters long clob. |
|
|
|
11g Release 11.2.0.4.0 - 64bit Production: |
|
1st execution |
|
CLOB := CLOB || VARCHAR2 approach: 00:00:37.35 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:01.69 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:01.68 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.11 <== Winner |
|
DBMS_LOB.append approach: 00:00:01.58 |
|
DBMS_LOB.writeappend approach: 00:00:00.49 |
|
|
|
2nd execution (just to show signal to noise level) |
|
CLOB := CLOB || VARCHAR2 approach: 00:00:43.80 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:01.65 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:01.61 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.11 <== Winner |
|
DBMS_LOB.append approach: 00:00:01.68 |
|
DBMS_LOB.writeappend approach: 00:00:00.46 |
|
|
|
12c Release 12.1.0.2.0 - 64bit Production: |
|
1st execution |
|
CLOB := CLOB || VARCHAR2 approach: 00:00:00.924 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:00.677 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:00.696 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.112 <== Winner |
|
DBMS_LOB.append approach: 00:00:00.720 |
|
DBMS_LOB.writeappend approach: 00:00:00.435 |
|
|
|
2nd execution (just to show signal to noise level) |
|
CLOB := CLOB || VARCHAR2 approach: 00:00:00.929 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:00.739 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:00.717 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.111 <== Winner |
|
DBMS_LOB.append approach: 00:00:00.717 |
|
DBMS_LOB.writeappend approach: 00:00:00.453 |
|
|
|
Oracle Database 19c Standard Edition 2 Release 19.9.0.0.0 - Production |
|
1st execution |
|
|
|
CLOB := CLOB || VARCHAR2 approach: 00:00:00.570737000 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:00.416159000 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:00.445300000 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.059103000 <== Winner |
|
DBMS_LOB.append approach: 00:00:00.435128000 |
|
DBMS_LOB.writeappend approach: 00:00:00.313811000 |
|
|
|
2nd execution (just to show signal to noise level) |
|
|
|
CLOB := CLOB || VARCHAR2 approach: 00:00:00.603622000 |
|
CLOB := CLOB || TO_CLOB(VARCHAR2) approach: 00:00:00.448007000 |
|
CLOB := CLOB || TMP_CLOB approach: 00:00:00.426496000 |
|
app(v_clob, v_vc, VARCHAR2) approach: 00:00:00.056168000 <== Winner |
|
DBMS_LOB.append approach: 00:00:00.433901000 |
|
DBMS_LOB.writeappend approach: 00:00:00.314912000 |
|
|
You should have included a DBMS_LOB.writeappend in addition to the DBMS_LOB.append. They are much faster (at least on 11.2) as the LOB.append does conversion of charbuffer to CLOB first (creating an additional temporary CLOB) and then copies this CLOB contents to the main CLOB which is much less efficent than instruct Oracle to directly copy content of char buffer to end of CLOB.