Sign In
Sign In

PostgreSQL Management

Updated on 01 October 2025

PostgreSQL is an open-source object-relational database management system. It is known for its reliability, scalability, and extensive functionality, including JSON support, full-text search, stored procedures, extensions, and more.

With Hostman managed PostgreSQL databases, you get a fully managed PostgreSQL cluster without manual setup: everything is handled automatically.

When creating a cluster, you can select the PostgreSQL version: 14, 15, 16, 17, 18.

Creating Databases

When you create a new cluster, a database named default_db is created automatically. 

You can create additional databases:

  1. Go to the Databases section of your Hostman control panel.

  2. Click on the cluster.

  3. In the Databases tab, click Add.

C07452c6 6988 49f2 Bc35 Aa3bb634a399

  1. Provide a name for your database: 3–64 characters. Letters, numbers, and special characters are allowed.

  2. Add a description, if necessary.

  3. Click Create.

Ab9a9e55 A570 4695 B4a6 A4d0e8601b2f

Users and Privileges

In your control panel, you can manage PostgreSQL users and their privileges.

Creating Users

  1. Go to the Databases section and click on the cluster.

  2. Open the Users tab and click Add.

Ee04ecdb 2a74 4a55 8e18 A7f2903c04de

  1. Set the username and password:

    • Username: 3–64 characters. Letters, numbers, and special characters are allowed.

    • Password: 8–30 characters. Letters, numbers, and special characters are allowed.

  2. (Optional) Configure the user’s privileges. You can also leave the default parameters and change them later at any time.

  3. Click Create.

Modifying Privileges

To update the privileges of an existing user:

  1. Go to the Databases section and click on the cluster.

  2. Open the Users tab.

  3. Click the three dots next to the user.

  4. Select Privileges.

26a04155 88de 43fd 8c8a E715a4e9d7b0

  1. Choose the required privileges. You can grant access to a specific database or grant the same privileges for all databases by enabling Identical for all databases in the top right.

6eae3e45 839c 4848 9e8b Be016c8df921

Available Privileges

Privilege

Description

SELECT

Read data from tables, views, and sequences.

INSERT

Add new rows into tables.

UPDATE

Modify existing rows in tables.

DELETE

Delete rows from tables.

TRUNCATE

Quickly delete all rows in a table (without logging each row deletion).

CREATE

Create new objects (tables, views, functions, etc.).

REFERENCES

Use a table as a foreign key.

TRIGGER

Create and execute triggers on a table.

TEMPORARY

Create temporary tables.

CREATEDB

Create new databases.

CREATE_ROLE

Create new roles.

Changing User Password

You can change the user password:

  1. Go to the Database section and click on the cluster.
  2. Go to the Users tab.
  3. Click the three dots next to the user.
  4. Select Change password.
  5. Enter a new value and save changes.

Extensions

PostgreSQL extensions allow you to expand the functionality of PostgreSQL databases by adding additional capabilities to solve certain tasks. You can read more about extensions in the PostgreSQL documentation.

Enabling Extensions

To enable or disable extensions:

  1. Go to the Databases section and click on the cluster.

  2. Go to the Configuration tab.

  3. Click Modify next to Extensions.

E5f9e2f3 B9fc 4d53 A4f5 B50f1e751b0d

  1. Select the database and the required extensions. To apply the same extensions to all databases in the cluster, enable the Use the same extensions for all databases option.

C6debd31 Dcea 4e79 B5bb 5bbfc83252dc

Extensions List

The following extensions are available:

Extension

Description

amcheck

Index and table integrity checking.

citext

Case-insensitive string type.

pg_stat_statements

Collects and analyzes SQL query execution statistics.

pg_trgm

String search and comparison using trigrams (fuzzy search).

pgcrypto

Cryptographic functions: hashing, encryption, digital signatures.

postgis

Work with geographic and geometric data (GIS).

postgis_topology

Topological models for spatial data.

uuid-ossp

Generate UUIDs of various versions.

pgvector

Vector data type with ivfflat and hnsw indexes for similarity search.

pgagent

Job scheduling agent

Database Parameters

You can change database settings to optimize its performance. 

By default, the database is created with the parameters that are suitable for most tasks and will ensure the performance of the selected configuration. However, if your project requires specific settings, you can change them as you wish. 

Be careful and change parameters only if you are sure of their purpose. Incorrect configuration can negatively affect the operation of the database and its performance.

Changing Parameters

  1. Go to the Databases section and click on the cluster.

  2. Go to the Configuration tab.

  3. Click Modify parameters next to Database parameters.

70e7f8cc F84b 4124 960b C33e2d598237

  1. Adjust the parameters. To read more about each parameter, click Open description next to it.

9e882ca8 Ff8a 4e4c A153 94bc49e5c8f8

  1. Click Apply at the bottom of the page.

Parameters List

Parameter

Values

Default

autovacuum_analyze_scale_factor

0–100

0.1

autovacuum_max_workers

1–262143

3

autovacuum_naptime

1–2147483

60

autovacuum_vacuum_insert_scale_factor

0–100

0.2

autovacuum_vacuum_scale_factor

0–100

0.2

autovacuum_work_mem

-1–2147483647

-1

bgwriter_delay

10–10000

200

bgwriter_lru_maxpages

0–1073741823

100

deadlock_timeout

1–2147483647

1000

gin_pending_list_limit

64–2147483647

4096

idle_in_transaction_session_timeout

0–2147483647

0

join_collapse_limit

1–2147483647

8

lock_timeout

0–2147483647

0

max_prepared_transactions

0–262143

0

max_connections

1–262143

200

shared_buffers

16–1073741823

31232

wal_buffers

-1–262143

2048

temp_buffers

100–1073741823

1024

work_mem

64–2147483647

436

default_transaction_isolation

read committed

effective_cache_size

1–2147483647

524288

max_wal_size

2–2147483647

1024

min_wal_size

2–2147483647

80

max_worker_processes

0–262143

8

max_logical_replication_workers

0–262143

4

max_parallel_maintenance_workers

0–1024

2

max_parallel_workers

0–1024

8

max_parallel_workers_per_gather

0–1024

2

array_nulls

On/Off

On

backend_flush_after

0–256

0

backslash_quote

safe_encoding

bgwriter_flush_after

0–256

64

bgwriter_lru_multiplier

1–10

2

default_transaction_read_only

On/Off

Off

enable_hashagg

On/Off

On

enable_hashjoin

On/Off

On

enable_incremental_sort

On/Off

On

enable_indexscan

On/Off

On

enable_indexonlyscan

On/Off

On

enable_material

On/Off

On

enable_memoize

On/Off

On

enable_mergejoin

On/Off

On

enable_parallel_append

On/Off

On

enable_parallel_hash

On/Off

On

enable_partition_pruning

On/Off

On

enable_partitionwise_join

On/Off

Off

enable_partitionwise_aggregate

On/Off

Off

enable_seqscan

On/Off

On

enable_sort

On/Off

On

enable_tidscan

On/Off

On

exit_on_error

On/Off

Off

from_collapse_limit

1–2147483647

8

idle_session_timeout

0–2147483647

900000

jit

On/Off

On

plan_cache_mode

auto

quote_all_identifiers

On/Off

Off

standard_conforming_strings

On/Off

On

statement_timeout

0–2147483647

0

timezone

-13:59–+14:00

transform_null_equals

On/Off

Off

max_locks_per_transaction

1–2147483647

64

autovacuum_vacuum_cost_limit

-1–10000

200

checkpoint_timeout

30–86400

300

checkpoint_completion_target

0–1

0.5

wal_compression

On/Off

Off

random_page_cost

0–10

4

effective_io_concurrency

0–1000

1

log_lock_waits

On/Off

Off

log_temp_files

-1–2147483647

-1

track_io_timing

On/Off

Off

maintenance_work_mem

1024–2147483647

33554432

Resetting Parameters

You can easily restore the default parameters:

  1. Go to the Databases section and click on the cluster.

  2. Go to the Configuration tab.

  3. Click Modify parameters next to Database parameters.

  4. Scroll down to the bottom of the page and click Restore default settings.

Be careful: the parameters will be reset immediately, without additional confirmation.

Connecting to the Database

You can connect to your databases using Adminer or via terminal. Connecting via Adminer is possible only if the cluster has a public IP address.

Adminer

You can connect to the database via the built-in web interface Adminer. 

  1. Go to the Databases section and click on the cluster.

  2. Дlick the Web Interface button and select Adminer.

772dffc9 765b 4682 9447 63c0f8b6886c

Terminal

Install the PostgreSQL client:

  • Ubuntu/Debian
sudo apt install postgresql-client
  • Arch
sudo pacman -S postgresql-libs
  • Fedora
sudo dnf install postgresql

There are two ways to connect to a PostgreSQL cluster:

  • via public IP;
  • via private IP.

You can copy the connection command from:

  • the Dashboard tab:

6dd75993 D295 4779 9c0e 0cecd159c52d

  • the Connection tab.

D176824e 4a02 42f8 99ca 34a28d591937

Role Management

A user with the CREATE ROLE privilege can:

  • create new users (CREATE USER);
  • create roles (CREATE ROLE);
  • manage role memberships (GRANT ... TO ...).

Creating a User

A user is a role that is allowed to log in to the database. Such a role can connect with a username and password.

To create a user with a password, run:

CREATE USER someuser WITH PASSWORD 'password';

Here, someuser is the username and password is the password.

The new user will appear in the Users tab shortly after creation.

Creating a Role and Assigning It to a User

Instead of granting permissions directly to each user, it is better to create roles with the required privileges and then assign users to these roles.

Let’s create two roles: one with read-only access, and another with read and write access.

Read-only role:

CREATE ROLE app_reader;

Read/write role:

CREATE ROLE app_writer;

Assign a role to a user:

GRANT app_writer TO someuser;

Schema Configuration

By default, all PostgreSQL tables are created in the public schema. To grant permissions, create a new schema:

CREATE SCHEMA app_data;

Create tables in the new schema:

CREATE TABLE app_data.users (
  id SERIAL PRIMARY KEY,
  username VARCHAR(50) NOT NULL,
  email VARCHAR(100) UNIQUE NOT NULL
);

CREATE TABLE app_data.orders (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES app_data.users(id),
  order_date TIMESTAMP DEFAULT now()
);

Grant access to the schema for the previously created roles:

GRANT USAGE ON SCHEMA app_data TO app_reader;
GRANT USAGE ON SCHEMA app_data TO app_writer;

Grant the right to create objects in the schema:

GRANT CREATE ON SCHEMA app_data TO app_writer;

Table Permissions

Grant read access to all existing tables in the schema:

GRANT SELECT ON ALL TABLES IN SCHEMA app_data TO app_reader;

Grant read/write access:

GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA app_data TO app_writer;

Set default permissions for new tables:

ALTER DEFAULT PRIVILEGES IN SCHEMA app_data 
GRANT SELECT ON TABLES TO app_reader;
ALTER DEFAULT PRIVILEGES IN SCHEMA app_data  GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO app_writer;

And default permissions for new sequences:

ALTER DEFAULT PRIVILEGES IN SCHEMA app_data 
GRANT USAGE, SELECT ON SEQUENCES TO app_writer;

Creating a Dump

To create a dump, run:

pg_dump -x 'postgresql://<user>:<password>@<host>:5432/<db>' | gzip > default_db.sql.gz

The -x (--no-privileges) flag excludes GRANT and REVOKE commands from the dump, since permission management is handled via the control panel.

Without this flag, errors may occur when loading the dump, though they won’t affect data restoration.

Loading a Dump

To load a dump, run:

zcat default_db.sql.gz | psql 'postgresql://<user>:<password>@<host>:5432/<db>'

This command decompresses the dump and passes it to the PostgreSQL client for execution.

Was this page helpful?
Updated on 01 October 2025

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support