Reference
4 min read

Vercel Postgres FAQ

Discover answers to frequently asked questions about Vercel Postgres.
Table of Contents

By default, Postgres does not allow for a high number of open simultaneous connections. The maximum number of connections is 100, which includes connections reserved for administrative purposes. This would be labeled a direct connection.

This connection limit of 100 may not be sufficient for some applications with many concurrent users - especially in a serverless environment. To overcome this limitation, Vercel Postgres enables you to connect to your database with a connection pooler. When this is done, Neon will use PgBouncer in transaction mode to enable connection pooling, which allows for sharing, reusing and queuing database connections.

We recommend using the pooled connection when deploying your application since it enables Vercel Postgres to handle up to 10,000 simultaneous connections. However, if you use PostgreSQL features not supported in transaction mode which is used in pooled connections, you will need a direct connection to the database.

Review Connection pooling notes and limitations for more information.

The default provided connection is pooled, allowing up to 10,000 concurrent connections - this will be the best option in nearly all cases since a "pooled" connection avoids expensive connection setup.

You also have the ability to connect directly, allowing up to 100 concurrent connections on Hobby and 450 on Pro.

A Vercel Postgres database has two states, Active and Idle. By default, after 5 minutes of no active queries being run against the database, it will be put into an Idle state.

Upon a new query being run against the database, it will wake into an Active state - this can take a varying amount of time but is usually under ~5 seconds.

Vercel Postgres enters an Idle state to save compute resources when it is not actively being used.

Pro plan users can configure the time after which the database enters the Idle state. Alternatively, you can query your database at least once every five minutes to prevent the idle state as long as you are ok with the additional compute hours incurred. If you create a new deployment your database will automatically be "warmed" and enter the active state.

For basic queries, we recommend using the @vercel/postgres client out of the box as it provides an efficient way to interact with your Postgres database, has built-in support for connection pooling, and is compatible with Edge Functions. For more advanced functionality, we recommend using one of our supported Object-Relational Mapping (ORM) clients.

If you are having connection issues with using a graphical Postgres client, please check its support for Server Name Indication (SNI) included with the Transport Layer Security (TLS) protocol.

You can use pg_dump to import a Postgres database into your Vercel Postgres. Use the postgres connection environment variables created in your Vercel project to define the connection string to use with pg_dump.

To prevent timeouts when using Prisma with Vercel Postgres you can append the following query parameter to the connection string provided by Vercel: ?connect_timeout=0.

This helps in cases where the database is in an Idle state. The default timeout for a Prisma query is 5 seconds, and this is roughly the time taken to revert the database to an Active state - adding the no timeout parameter prevents this issue.

Follow the steps in the Prisma migration guide created by Neon.

Automated backups are not currently supported.

Select the database you want to view, select the Browse tab under the Data section, and then select the table you want to view.

Vercel Postgres aims to provide the right level of abstraction to allow you to focus on building your application.

If you are looking to use more advanced features such as branching and auto-scaling, then using the Neon integration will let you manage your instance directly with the Neon.tech app.

The vast majority of Postgres features are compatible with Vercel Postgres, however, there are some listed below that are not currently supported:

  • Roles with access permissions other than those granted to standard database owners in PostgreSQL
  • Unlogged tables are maintained on Neon compute local storage. These tables do not survive compute restarts (including when a Neon compute instance is placed into an Idle state)
  • Temporary tables, which are stored in compute local storage, are limited by compute local storage size
  • Session context, the Vercel Postgres service automatically closes idle connections after a period of inactivity
  • Statistics collected by the PostgreSQL cumulative statistics system are currently not saved when the Neon compute node is placed into an Idle state due to inactivity or restarted

Vercel Postgres currently supports Postgres version 15.

Vercel Postgres enforces SSL by default. Non-SSL connections are not supported.

See the Error Codes documentation for more information.

Last updated on April 16, 2024