PostgreSQL
The pg_fasttransfer extension allows you to run the FastTransfer tool directly from an SQL function, enabling fast data transfer between databases directly from PostgreSQL.
Extension Overview
| Item | Value |
|---|---|
| Repository | arpe-io/pg_fasttransfer |
| License | MIT |
| Latest version | v0.16.0 |
| Platforms | Linux (Debian/Ubuntu) and Windows |

Features
- Native PostgreSQL IntegrationExecute FastTransfer commands directly from SQL
- Secure Password ManagementBuilt-in encryption for sensitive credentials
- Detailed Result ReturnGet transfer statistics and performance metrics as SQL results
- Cross-PlatformAvailable for both Linux and Windows environments
- Flexible ConfigurationSupport for all FastTransfer parameters
Prerequisites
- Sudo/Administrator privileges
Required to install the extension.
- Valid FastTransfer license
Request a trial license.
- FastTransfer binaries
FastTransfer binaries installed on the system.
The PostgreSQL server process usually runs under the postgres user account. You must ensure that this user has the appropriate permissions to execute the FastTransfer binary and read the license file.
Compatibility
| PostgreSQL Version | Windows | Linux (Debian/Ubuntu 22.04 LTS) |
|---|---|---|
| PostgreSQL 18 | Supported | Supported |
| PostgreSQL 17 | Supported | Supported |
| PostgreSQL 16 | Supported | Supported |
| PostgreSQL 15 | Not supported | Supported |
Other distributions or PostgreSQL versions may work but have not been officially tested.
Installation
Download the appropriate release for your PostgreSQL version and operating system from the pg_fasttransfer releases page.
- Linux
- Windows
Automated installation (Linux)
The easiest way to install the extension on Linux is by using the install-linux.sh script included in the archive.
-
Extract the contents of the archive into a folder. This folder should contain
pg_fasttransfer.so,pg_fasttransfer.control,pg_fasttransfer--1.0.sqlandinstall-linux.sh. -
Make the script executable:
chmod +x install-linux.sh
- Run the script with administrator privileges:
sudo ./install-linux.sh
The script will automatically detect your PostgreSQL installation and copy the files to the correct locations.
Manual installation
If the automated script fails or you prefer to install the files manually:
- Stop your PostgreSQL service:
sudo systemctl stop postgresql
-
Locate your PostgreSQL installation directory, typically:
/usr/lib/postgresql/<version> -
Copy the files into the appropriate directories:
sudo cp pg_fasttransfer.so /usr/lib/postgresql/<version>/lib/
sudo cp pg_fasttransfer.control pg_fasttransfer--1.0.sql /usr/share/postgresql/<version>/extension/
- Restart your PostgreSQL service:
sudo systemctl start postgresql
Permissions setup (Linux)
Ensure the postgres user has proper permissions:
# Grant execute permission on the FastTransfer binary
sudo chmod +x /path/to/FastTransfer
sudo chown postgres:postgres /path/to/FastTransfer
sudo chmod 750 /path/to/FastTransfer
# Grant read permission on the license file
sudo chown postgres:postgres /path/to/license.lic
sudo chmod 640 /path/to/license.lic
Automated installation (Windows)
-
Extract the contents of the ZIP file into a folder. This folder should contain
pg_fasttransfer.dll,pg_fasttransfer.control,pg_fasttransfer--1.0.sqlandinstall-win.bat. -
Right-click on the
install-win.batfile and select "Run as administrator" -
The script will automatically detect your PostgreSQL installation and copy the files to the correct locations
Manual installation
If the automated script fails or you prefer to install the files manually:
-
Stop your PostgreSQL service
-
Locate your PostgreSQL installation folder, typically:
C:\Program Files\PostgreSQL\<version>
-
Copy the
pg_fasttransfer.dllfile into thelibfolder -
Copy the
pg_fasttransfer.controlandpg_fasttransfer--1.0.sqlfiles into theshare\extensionfolder -
Restart your PostgreSQL service
Permissions setup (Windows)
Make sure that the PostgreSQL service account (by default NT AUTHORITY\NetworkService or postgres) has:
- Execute permission on the
FastTransfer.exebinary - Read permission on the
.licfile
SQL Setup
After the files are in place, you need to set up the extension in your database.
Drop existing extension (if any)
DROP EXTENSION IF EXISTS pg_fasttransfer CASCADE;
Create the extension
CREATE EXTENSION pg_fasttransfer CASCADE;
Functions
pg_fasttransfer_encrypt
This function encrypts a given text string using pgp_sym_encrypt and encodes the result in base64. It is useful for storing sensitive information, such as passwords, in a secure manner within your SQL scripts.
The xp_RunFastTransfer_secure function will automatically decrypt any values passed to its --sourcepassword and --targetpassword arguments.
Syntax:
pg_fasttransfer_encrypt(text_to_encrypt text) RETURNS text
Example:
SELECT pg_fasttransfer_encrypt('MySecurePassword');
-- Returns: A base64-encoded encrypted string, e.g., "PgP...base64encodedstring=="
xp_RunFastTransfer_secure
This is the main function to execute the FastTransfer tool. It takes various parameters to configure the data transfer operation.
Password arguments (sourcepassword, targetpassword) will be automatically decrypted.
Syntax: all parameters and the returned table
xp_RunFastTransfer_secure(
sourceconnectiontype text DEFAULT NULL,
sourceconnectstring text DEFAULT NULL,
sourcedsn text DEFAULT NULL,
sourceprovider text DEFAULT NULL,
sourceserver text DEFAULT NULL,
sourceuser text DEFAULT NULL,
sourcepassword text DEFAULT NULL,
sourcetrusted boolean DEFAULT FALSE,
sourcedatabase text DEFAULT NULL,
sourceschema text DEFAULT NULL,
sourcetable text DEFAULT NULL,
query text DEFAULT NULL,
fileinput text DEFAULT NULL,
targetconnectiontype text DEFAULT NULL,
targetconnectstring text DEFAULT NULL,
targetserver text DEFAULT NULL,
targetuser text DEFAULT NULL,
targetpassword text DEFAULT NULL,
targettrusted boolean DEFAULT FALSE,
targetdatabase text DEFAULT NULL,
targetschema text DEFAULT NULL,
targettable text DEFAULT NULL,
degree integer DEFAULT NULL,
method text DEFAULT NULL,
distributekeycolumn text DEFAULT NULL,
datadrivenquery text DEFAULT NULL,
loadmode text DEFAULT NULL,
batchsize integer DEFAULT NULL,
useworktables boolean DEFAULT FALSE,
runid text DEFAULT NULL,
settingsfile text DEFAULT NULL,
mapmethod text DEFAULT NULL,
license text DEFAULT NULL,
loglevel text DEFAULT NULL,
nobanner boolean DEFAULT NULL,
fasttransfer_path text DEFAULT NULL,
debug boolean DEFAULT FALSE
) RETURNS TABLE (
exit_code integer,
output text,
error_message text,
total_rows bigint,
total_columns integer,
transfer_time_ms bigint,
total_time_ms bigint
)
Usage Examples
- Linux: PostgreSQL → SQL Server
- Windows: SQL Server → PostgreSQL
Transfer data from PostgreSQL to SQL Server using the extension:
SELECT * FROM xp_RunFastTransfer_secure(
targetconnectiontype := 'msbulk',
sourceconnectiontype := 'pgsql',
sourceserver := 'localhost:5432',
sourceuser := 'postgres',
sourcepassword := pg_fasttransfer_encrypt('MyActualPassword'),
sourcedatabase := 'tpch',
sourceschema := 'tpch_1',
sourcetable := 'orders',
targetserver := 'localhost,1433',
targetuser := 'migadmin',
targetpassword := pg_fasttransfer_encrypt('AnotherSecurePassword'),
targetdatabase := 'target_db',
targetschema := 'tpch_1',
targettable := 'orders',
loadmode := 'Truncate',
license := '/tmp/FastTransfer_linux-x64_v0.15.0/FastTransfer.lic',
loglevel := 'information',
nobanner := false,
fasttransfer_path := '/tmp/FastTransfer_linux-x64_v0.15.0',
debug := true
);
Transfer data from SQL Server to PostgreSQL:
SELECT * FROM xp_RunFastTransfer_secure(
sourceconnectiontype := 'mssql',
sourceserver := 'localhost',
sourcepassword := pg_fasttransfer_encrypt('MyWindowsPassword'),
sourceuser := 'FastLogin',
sourcedatabase := 'tpch10',
sourceschema := 'dbo',
sourcetable := 'orders',
targetconnectiontype := 'pgcopy',
targetserver := 'localhost:15433',
targetuser := 'postgres',
targetpassword := pg_fasttransfer_encrypt('MyPostgresPassword'),
targetdatabase := 'postgres',
targetschema := 'public',
targettable := 'orders',
method := 'Ntile',
degree := 12,
distributekeycolumn := 'o_orderkey',
loadmode := 'Truncate',
batchsize := 1048576,
mapmethod := 'Position',
loglevel := 'information',
nobanner := true,
fasttransfer_path := 'D:\sources\FastTransfer',
debug := true
);
Function Return Structure
The function returns a table with the following columns:
exit_codeintegeroutputtexterror_messagetexttotal_rowsbiginttotal_columnsintegertransfer_time_msbiginttotal_time_msbigintDebug Parameter
The debug parameter is a boolean flag that controls whether the full FastTransfer output is returned in the output column:
- outputContains the entire log from FastTransfer
- error_messageAny error lines
- outputAn empty string
- error_messageStill contains any error lines