By default, PolarDB databases compatible with Oracle add new data to the first available free-space in a table. The space is vacated by vacuumed records. The APPEND directive following an INSERT or SELECT statement instructs the server to bypass mid-table free space and affix new rows to the end of the table. This optimizer hint improves the performance of loading multiple entries.
The APPEND optimizer hint has the following syntax:
For example, the following statement compatible with Oracle databases instructs the server to append the data in the INSERT statement to the end of the sales table:
INSERT /*+APPEND*/ INTO sales VALUES (10, 10, '01-Mar-2011', 10, 'OR');
PolarDB databases compatible with Oracle support the APPEND hint when you add multiple rows by using a single INSERT statement.
INSERT /*+APPEND*/ INTO sales VALUES (20, 20, '01-Aug-2011', 20, 'NY'), (30, 30, '01-Feb-2011', 30, 'FL'), (40, 40, '01-Nov-2011', 40, 'TX');
The APPEND hint can also be included in the SELECT clause of an INSERT INTO statement.
INSERT INTO sales_history SELECT /*+APPEND*/ FROM sales;