Skip to main content
A managed PostgreSQL instance with a client-certificate TLS connection, a database and a role that are yours, popular extensions ready to enable and pg_cron for scheduled jobs. Facts shared by every engine (limits, snapshots, Insights) are on the Databases overview.

Connect

Copy the connection URL from the database’s page in the dashboard. It has this shape, with the squarecloud user and the squarecloud database created for you:
PostgreSQL requires SSL/TLS and the client certificate, besides the password. Download the .pem under Connection → SSL/TLS certificate and point the client to it:
Go clients reject sslmode=verify-full with this certificate (x509: certificate relies on legacy Common Name field): it names the host only in its Common Name, which Go no longer checks. Use sslmode=verify-ca, which still validates the certificate.
ORMs and other clients (Prisma, Drizzle, JDBC, GUI tools) are covered in database connection errors.

Connections

Each database accepts up to 256 simultaneous connections, of which 253 are available to your clients. Past that, new connections fail with remaining connection slots are reserved for roles with the SUPERUSER attribute (or sorry, too many clients already). Create one pool per process at startup and reuse it, sized so that every app, worker and shard together stays under the limit. A new connection per request or per query exhausts the limit quickly. The Insights tab shows who holds the open connections.

Your user and permissions

The squarecloud role has LOGIN, CREATEDB, CREATEROLE and BYPASSRLS, and owns the squarecloud database. You can create databases, schemas, roles and grants, and change settings a regular user may change, for a session or as a default:
The role is not a superuser and has no replication rights. That rules out:
  • ALTER SYSTEM and settings reserved to superusers;
  • server-side COPY ... TO/FROM 'file' (use \copy in psql, which reads and writes on your machine);
  • untrusted languages such as plpython3u;
  • logical replication and change data capture tools that need it.

Extensions

Already installed: plpgsql, plus pg_cron and pg_stat_statements in the postgres database. You can enable these in any of your databases with CREATE EXTENSION, in the database that will use them: vector (pgvector), pg_trgm, pgcrypto, uuid-ossp, citext, hstore, unaccent, ltree, btree_gin, btree_gist, cube, dict_int, fuzzystrmatch, intarray, isn, lo, seg, tablefunc, tcn, tsm_system_rows, tsm_system_time.
No other extension is available, and none can be added on request. PostGIS, for example, is not available.

Scheduled jobs with pg_cron

pg_cron lives in the postgres database. Connect to postgres (same URL, ending in /postgres) and schedule the job to run in your database. Schedules are in UTC:
The run history in cron.job_run_details is never purged automatically. Schedule a cleanup of your old rows:

Memory and configuration

  • shared_buffers is 25% of the database’s RAM (at least 128 MB). Changing the RAM restarts the database to apply it.
  • PostgreSQL relies on the operating system’s file cache for the rest, so the RAM shown in the dashboard climbs and then stays high. That is normal, not a leak.
  • A single query can write at most 1 GB of temporary files (sorts, hashes). Past it the query fails with temporary file size exceeds temp_file_limit: add an index or process the data in batches.
  • The write-ahead log takes 256 to 512 MB of the database’s storage.
  • The server configuration is the same on every database and can’t be changed per database.

Slow queries

Statements that take 100 ms or more are recorded, and the Insights tab lists them with their mean time. For your own analysis, connect to the postgres database and query pg_stat_statements, and use EXPLAIN ANALYZE on the statement:

Snapshots

A PostgreSQL snapshot holds every database and role of the instance. Besides the general cases, it fails when a database has ALLOW_CONNECTIONS false, or when your own lock (LOCK TABLE, a long ALTER TABLE) blocks it for more than 5 minutes. The export is plain SQL text, so a database close to its 10 GB of storage may not fit in a snapshot.

Common errors

Contact us

If you continue facing technical difficulties, our specialized support team is available to assist you. Contact us and we’ll be happy to help you resolve any issue: support quality is a big part of why developers rate Square Cloud 4.9/5 across 402 reviews on Google and Trustpilot.