Example: Perform Bulk Copy and Create B-tree Table
The following example of a bulk copy uses a B-tree table:
CREATE TABLE tmp2
(col1 INTEGER NOT NULL,
col2 CHAR(25));. . .
Populate table. . .
Save any data needed in table
MODIFY tmp2 TO TRUNCATED;
MODIFY tmp2 TO btree;
SET NOJOURNALING ON tmp2;
COPY tmp2() FROM 'tmp2.saved'
WITH ROW_ESTIMATE = 10000,
LEAFFILL = 70,
FILLFACTOR = 95,
ALLOCATION = 1000;
The existing table tmp2 is truncated to assure it has fewer than 18 pages. This also removes any indexes. Journaling is disabled for the table with the SET NOJOURNALING statement. The table meets the bulk copy requirements and a bulk copy is performed.
The COPY statement includes a row estimate for efficient sorting during the copy. The LEAFFILL and FILLFACTOR clauses allow the B‑tree table to be set up as specified during the copy operation. The allocation clause provides for efficient future table growth.
Last modified date: 08/14/2024