Neon
This guide explains how to connect a Neon Postgres database to a PolyScale cache and how to work with Neon branches in conjunction with PolyScale. Neon is a Postgres compatible database that can be connected to PolyScale just like any other database. Read on for details of working with Neon and PolyScale.


The video below illustrates how to get connected. Or you can read the steps below.
Connecting Neon to PolyScale
Step 0: Create a PolyScale account
If you do not already have a PolyScale account, you can create an account here. PolyScale offers a free tier and no credit card is required.
Step 1: Create your PolyScale Cache
1.1 Retrieve your Neon Host
In your Neon project, from the Connection details section of your Dashboard, you can find your host name within the Connection string
. Be sure you have selected the Branch for which you wish to add a PolyScale cache.
1.2 Configure your PolyScale Cache
- In your PolyScale account, click on the New Cache button
- Give the cache a Name
- Select PostgreSQL for the Type
- Enter the Host from Step 1.1 above
- Enter
5432
for the Port - Click Create

Your cache is now created. PolyScale automatically checks to see that your database is accessible from all our global PoPs.
Step 2: Connect to your PolyScale Cache
Using your PolyScale cache is simple -- instead of connecting to your Neon database directly, you'll replace your original connection string with the PolyScale connection string in your application.
For example, if your original connection string was: postgres://postgres:zqGHFAbPLvVCKw@ep-black-flask-024570.ap-southeast-1.aws.neon.tech:5432/neondb
Your PolyScale connection string might be: postgres://postgres:zqGHFAbPLvVCKw@psedge.global:5432/neondb?application_name=590174cd-2dde-4bf0-adab-2cc5c55cd6ea
If the client you are connecting from does not enable SSL by default (eg PG), you will need to append a sslmode=require
parameter to your Neon connection string, whether connecting directly or via PolyScale.
That's it.
Using Neon Branches with PolyScale
If you are using Branching in Neon and would like to connect PolyScale to multiple branches, a best practice approach is to create a separate PolyScale Cache for each branch. This allows you to work on each branch independently and not run the risk of mixing cached data across branches, which may be undesirable. There is no additional cost for creating an additional Cache for the branch. Finally, be sure when creating the Branch to create an endpoint.
To create the new branch with an associated PolyScale Cache, simply create the new Cache using the hostname of the new branch. That will provide a new cache id which is then passed in as part of the connection string using the application_name parameter.
So, if the connection string for your orignal branch via PolyScale was: postgres://postgres:zqGHFAbPLvVCKw@psedge.global:5432/neondb?application_name=
590174cd-2dde-4bf0-adab-2cc5c55cd6ea
The connection string for your new branch might be: postgres://postgres:zqGHFAbPLvVCKw@psedge.global:5432/neondb?application_name=
7e011c18-2cd0-4995-8c9d-ebe66a1dd393
You now have a PolyScale cache you can use in conjunction with your Neon database branch.