Skip to main content

PostgreSQL

PostgreSQL is an open-source object-relational database management system known for its reliability and performance.

Connect to PostgreSQL

  1. In the Dremio console, click Add Data on the Home page.
  2. In the Add Data dialog, select PostgreSQL.
  3. Configure the connection using the sections below, then click Save.

General

The General tab contains the required fields to create a PostgreSQL connection.

Perform these steps in the General tab:

  1. For Name, enter a name for the connection. The name cannot include the following special characters: /, :, [, or ].

  2. For Host, enter the PostgreSQL host name.

  3. For Port, enter the PostgreSQL port number. The default port is 5432.

  4. For Database, enter the PostgreSQL database name.

  5. (Optional) For Encrypt connection, enable encrypted connections to PostgreSQL using SSL. You can modify the encryption validation mode under Advanced Options.

  6. For Authentication, you must choose one of the following authentication options:

    • Master Authentication, this is the default option. Provide the username and password of a master database user with permissions to read required objects:
      • For Username, enter your PostgreSQL database username.
      • For Password, enter your PostgreSQL database password.
    • Secret Resource URL:
      • For Username, enter your PostgreSQL database username.
      • For Secret Resource Url, enter the Secret Resource URL that allows Dremio to fetch the password from AWS Secrets Manager. The Secret Resource URL is the Amazon Resource Name (ARN) for the secret (for example, arn:aws:secretsmanager:us-west-2:123456789012:secret:my-rds-secret-VNenFy).

Advanced Options

Click Advanced Options in the sidebar. All advanced options are optional.

Advanced OptionDescription
Record fetch sizeNumber of records to fetch at once. Set to 0 (zero) to have Dremio automatically decide. The default record fetch size is 200.
Maximum Idle ConnectionsThe total number of connections allowed to be idle at a given time. The default maximum idle connections is 8.
Connection Idle TimeThe amount of time (in seconds) allowed for a connection to remain idle before the connection is terminated. The default connection idle time is 60 seconds.
Encryption
Validation Mode
When encryption is enabled, set the validation mode as one of the following:
  • Validate certificate and hostname (default mode)
  • Validate certificate only
  • Do not validate certificate or hostname
Connection PropertiesCustom key value pairs for the connection. To add a connection property, click Add property and add the property name and value.

Reflection Refresh

The Reflection Refresh tab in the sidebar allows you to set time intervals for Reflections to refresh or expire.

  • Never refresh: Select to prevent automatic Reflection refresh; otherwise, the default is to refresh automatically.
  • Refresh every: Define how often to refresh Reflections, specified in hours, days, or weeks. This option is ignored if Never refresh is selected.
  • Set refresh schedule: Specify the daily or weekly schedule.
  • Never expire: Select to prevent Reflections from expiring; otherwise, the default is to expire automatically after the time limit specified in Expire after.
  • Expire after: The time limit after which Reflections expire and are removed from Dremio, specified in hours, days, or weeks. This option is ignored if Never expire is selected.

Metadata

You can configure settings to refresh metadata and handle datasets. Click Metadata in the sidebar.

Dataset Handling

These are the Dataset Handling parameters. All Dataset Handling parameters are optional.

ParameterDescription
Remove dataset definitions if underlying data is unavailableBy default, Dremio removes dataset definitions if underlying data is unavailable. Useful when files are temporarily deleted and added back in the same location with new sets of files.

Metadata Refresh

These are the Metadata Refresh parameters:

  • Dataset Discovery: The refresh interval for fetching top-level object names such as databases and tables. Set the time interval using this parameter.

    ParameterDescription
    Fetch every(Optional) Set the frequency to fetch object names in minutes, hours, days, or weeks. The default frequency to fetch object names is 1 hour.
  • Dataset Details: The metadata that Dremio needs for query planning such as information required for fields, types, shards, statistics, and locality. These are the parameters to fetch the dataset information. All Dataset Details parameters are optional.

    ParameterDescription
    Fetch modeYou can choose to fetch only from queried datasets that are set by default. Dremio updates details for previously queried objects. Fetching from all datasets is deprecated.
    Fetch everyYou can choose to set the frequency to fetch dataset details in minutes, hours, days, or weeks. The default frequency to fetch dataset details is 1 hour.
    Expire afterYou can choose to set the expiry time of dataset details in minutes, hours, days, or weeks. The default expiry time of dataset details is 3 hours.

Privileges

This connection inherits privileges from Project settings. To grant specific users or roles additional privileges in this connection:

  1. Enter the username or role name that you want to grant access to and click the Add to Privileges button. The added user or role is displayed in the USERS/ROLES table.
  2. For the users or roles in the USERS/ROLES table, toggle the checkmark for each privilege you want to grant on the Dremio source that is being created.
  3. Click Save after setting the configuration.

See Privileges for additional information about privileges.

Edit a PostgreSQL Connection

  1. Enter the username or role name that you want to grant access to and click Add to Privileges. The user or role is displayed in the USERS/ROLES table.
  2. Toggle the checkmark for each privilege you want to grant.
  3. Click Save.

Delete a PostgreSQL Connection

  1. On the Open Catalog page, under Connections, right-click the connection and select Delete.
  2. Click Delete to confirm.

Predicate Pushdowns

Dremio offloads these operations to PostgreSQL:

*, +, -, /, %
<, <=, <>, =, >, >=, !=
AND, NOT, OR, ||
ABS
ACOS
ADD_MONTHS
ASIN
ATAN
ATAN2
AVG
CAST
CBRT
CEIL
CEILING
CHAR_LENGTH
CHARACTER_LENGTH
CONCAT
COS
COT
COVAR_POP
COVAR_SAMP
DATE_ADD
DATE_SUB
DATE_TRUNC_CENTURY
DATE_TRUNC_DAY
DATE_TRUNC_DECADE
DATE_TRUNC_HOUR
DATE_TRUNC_MINUTE
DATE_TRUNC_MONTH
DATE_TRUNC_QUARTER
DATE_TRUNC_SECOND
DATE_TRUNC_WEEK
DATE_TRUNC_YEAR
DEGREES
E
EXP
EXTRACT_CENTURY
EXTRACT_DAY
EXTRACT_DECADE
EXTRACT_DOW
EXTRACT_DOY
EXTRACT_EPOCH
EXTRACT_HOUR
EXTRACT_MILLENNIUM
EXTRACT_MINUTE
EXTRACT_MONTH
EXTRACT_QUARTER
EXTRACT_SECOND
EXTRACT_WEEK
EXTRACT_YEAR
FLOOR
IS DISTINCT FROM
IS NOT DISTINCT FROM
IS NOT NULL
IS NULL
LAST_DAY
LCASE
LEFT
LENGTH
LIKE
LN
LOCATE
LOG
LOG10
LOWER
LPAD
LTRIM
MAX
MEDIAN
MIN
MOD
PERCENT_CONT
PERCENT_DISC
PI
POSITION
POW
POWER
RADIANS
REGEXP_LIKE
REPLACE
REVERSE
RIGHT
ROUND
RPAD
RTRIM
SIGN
SIN
SQRT
STDDEV
STDDEV_POP
STDDEV_SAMP
SUBSTR
SUBSTRING
SUM
TAN
TO_CHAR
TO_DATE
TRIM
TRUNC
TRUNCATE
UCASE
UPPER
VAR_POP
VAR_SAMP

Data Type Map

Dremio supports PostgreSQL data types, as shown in the following table, which provides the mappings from PostgreSQL to Dremio data types. If there are additional PostgreSQL types not listed in the table, those types are not supported in Dremio.

PostgreSQL Data TypeDremio Type
BIGSERIALBIGINT
BITBOOLEAN
BOOLBOOLEAN
BPCHARVARCHAR
BYTEAVARBINARY
CHARVARCHAR
DATEDATE
DOUBLE PRECISIONDOUBLE
FLOAT4FLOAT
FLOAT8DOUBLE
INT2INTEGER
INT4INTEGER
INT8BIGINT
INTERVAL_DSINTERVAL (day to seconds)
INTERVAL_YMINTERVAL (years to months)
MONEYDOUBLE
NAMEVARCHAR
NUMERICDECIMAL
OIDBIGINT
SERIALINTEGER
TEXTVARCHAR
TIMETIME
TIMESTAMPTIMESTAMP
TIMESTAMPTZTIMESTAMP
TIMETZTIME
VARCHARVARCHAR