Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Database

database: The configuration for the PostgreSQL database connection.

Examples:

database:
  url: postgresql://user:password@hostname:port/dbname?sslmode=disable
database:
  url: postgresql://user:password@hostname:port/dbname?sslmode=disable
  max_idle_connections: 2
  max_idle_lifetime: 5m
  max_open_connections: 5
  max_open_lifetime: 5m

URL

url: The URI to connect to.

This string SHOULD be prefixed with postgresql://, but postgres:// will work for compatibility reasons.

This connection string is passed directly to the database driver, so you can configure other connection-related settings in this URL (using libpq style query args - see https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS for more info).

URL secrets file

url_file: The file path to where the full database URL can be found.

This path, if provided, should point to a plain text file containing solely the postgres URL. This is provided as an alternative to url to avoid embedding secrets into the configuration file directly.

url takes priority over url_file. If url_file cannot be loaded at startup, Venator will crash.

If the contents of url_file cannot be parsed as a URI, Venator will crash.

Max idle connections

max_idle_connections: The maximum number of idle (not actively running a query) connections to keep open in the connection pool.

See: max_open_connections

Max open connections

max_open_connections: The maximum number of active (running a query) connections the connection pool is allowed to have.

These options configure the maximum number of parallel connections available to Venator. Generally, you shouldn’t need too many (2+2 may be a good starting point), and you should also be conscious of the additional resource usage incurred by having more postgres connections on the postgres server. More connections will allow for more concurrent operations, but you should only really be concerned about that if your server is exceptionally high traffic, and you’re seeing lots of warnings about transactions taking a long time.

By default, there is no connection pooling - this is expected to change.

Max idle lifetime

max_idle_lifetime (string (duration), optional): The maximum lifetime of an idle connection.

See: max_open_lifetime

Max open lifetime

max_open_lifetime (string (duration), optional): The maximum lifetime of an active connection. (8-bit integer, optional) Controls how long connections live for before being destroyed. You can usually leave this disabled if you aren’t running a fancy postgres server configuration, but if you are, you probably know what these values should be anyway.

Example:

database:
  max_idle_lifetime: 5m
database:
  max_open_lifetime: 5m
database:
  max_idle_lifetime: 5m
  max_open_lifetime: 5m

Compression level

compression_level: The compression level to apply to the database.

By default, large, repetitive columns (such as event content) will have their contents compressed before being inserted into the database, and decompressed on read. Content is only compressed if the uncompressed size is greater than 512 bytes, and the space savings potential is 50% or more. The default compression level is -1, which makes the underlying zlib library select a balanced compression level. This is the recommended default. Setting the value to 0 disables compression entirely, -2 disables LZ77 encoding (only using Huffman coding), and values 1 through 9 set the compression level manually (1 being fastest, 9 being best but slowest).

Once set, changing this value will only affect future compress jobs. The database is not automatically re-compressed.

Example:

database:
  compression_level: 9  # Warning: values above 6 are generally fruitlessly slower.