Importing Data In Parallel Using GDS

INSERT and COPY statements are serially executed to import a small volume of data. To import a large volume of data to GaussDB(DWS), you can use GDS to import data in parallel using a foreign table.

In the current GDS version, you can import data to databases from pipe files.

Overview

You can import data in parallel from the common file system (excluding HDFS) of a server to GaussDB(DWS).

Data files to be imported are specified based on the import policy and data formats set in a foreign table. Data is imported in parallel through multiple DNs from source data files to the database, which improves the overall data import performance. Figure 1 shows an example.

You can pre-process data, such as replacing invalid characters and processing fault tolerance, by configuring parameters in a foreign table.
Figure 1 Importing data in parallel

The concepts mentioned in the preceding figure are described as follows:

Parallel Import Using GDS

Import Process

Figure 3 Concurrent import process using GDS
Table 1 Process description

Process

Description

Prepare source data.

Prepare the source data files to be imported to the database and upload the files to the data server.

For details, see Preparing Source Data.

Start GDS.

Install, configure, and start GDS on the data server.

For details, see Installing, Configuring, and Starting GDS.

Create a foreign table.

A foreign table is used to identify source files. The foreign table stores information of a source data file, such as location, format, destination location, encoding format, and data delimiter.

For details, see Creating a GDS Foreign Table.

Import data.

After creating the foreign table, run the INSERT statement to quickly import data to the target table. For details, see Importing Data.

Handle import errors.

If errors occur during parallel data import, handle errors based on the error information to ensure data integrity.

For details, see Handling Import Errors.

Improve query efficiency.

After data is imported, run the ANALYZE statement to generate table statistics. The ANALYZE statement stores the statistics in the PG_STATISTIC system catalog. When you run the plan generator, the statistics help you generate an efficient query execution plan.

Stop GDS.

After data is imported, log in to each data server and stop GDS.

For details, see Stopping GDS.