PgDAC

TPgLoader Component

There are cases when you need to put large amount of data to a PostgreSQL database. Of course, you may construct INSERT SQL statement and execute it with the TPgSQL component. But it takes a lot of time. PostgreSQL provides COPY FROM STDIN command that allows to load data much faster. PgDAC simplifies using this command by the TPgLoader component.

The COPY command has two modes: text and binary. TPgAlerter supports both these modes. By default the binary mode is used for a connection with 3.0 protocol. In the binary mode TPgLoader works a little faster but some data types are not supported in this mode. Set the TextMode property to True to force text mode. In the text mode you can load data to columns with any PostgreSQL data type.

Note: COPY stops operation at the first error. But the target table will already have received earlier rows in a COPY FROM. These rows will not be visible or accessible, but they will still occupy disk space. This might amount to a considerable amount of wasted disk space if the failure happened well into a large copy operation. You may wish to invoke VACUUM to clean the wasted space.

To write your own loader you should:

See Also

© 1997-2020 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback