DEV Community

tongxi
tongxi

Posted on

openGauss Importing Data

You can use INSERT, COPY, or \copy (a gsql meta-command) to import data to the openGauss database. The methods have different characteristics. For details, see Table 1.

Table 1 Import modes

Mode

Characteristics

INSERT

Insert one or more rows of data, or insert data from a specified table.

COPY

Run the COPY FROM STDIN statement to write data into the openGauss database.

Service data does not need to be stored in files when it is written from other databases to the openGauss database through the CopyManager interface driven by JDBC.

\copy, a gsql meta-command

Different from the SQL COPY statement, the \copy command can read data from or write data into only local files on a gsql client.

NOTE:
\copy applies only to small-scale data import in good format. It does not preprocess invalid characters or provide error tolerance. Therefore, \copy cannot be used in scenarios where abnormal data exists. COPY is preferred for data import.

Running the INSERT Statement to Insert Data

Running the COPY FROM STDIN Statement to Import Data

Using a gsql Meta-Command to Import Data

Using gs_restore to Import Data

Updating Data in a Table

Deep Copy

ANALYZE Table

Doing VACUUM to a Table

Managing Concurrent Write Operations

Top comments (0)