Connect Neon to PolyScale manually
Connect Neon to PolyScale to distribute and cache your data globally
Important Update Regarding PolyScale Support
The PolyScale Serverless product will be discontinued as of June 1st, 2024. For an overview of what this means and the reasoning behind the decision, we encourage you to read the official PolyScale announcement.
While the instructions for utilizing the PolyScale will continue to be accessible to existing users for the time being, they will be phased out from the Neon documentation in the near future. We recommend users begin planning for this transition and explore alternative solutions.
For support and guidance through this transition, please feel free to reach out to our Support team or the Neon community on Discord.
PolyScale is a serverless database cache service. With PolyScale, you can distribute and cache your data globally, allowing you to scale your database without altering transactional semantics. No coding or infrastructure changes are required. You can connect Neon to PolyScale in minutes, providing your database-backed applications with speedy access to your Neon data from anywhere in the world.
note
Neon also provides a PolyScale integration, which allows you to set up a PolyScale cache in just a few clicks. The PolyScale integration creates a cache for the read-write compute endpoint associated with your project's primary branch. If you do not want to use the integration or you want to set up a cache for a read-only compute endpoint (read replica) or a non-primary branch, use these manual setup instructions.
Follow the steps below to connect your Neon database to PolyScale manually.
Retrieve your Neon connection details
In the Connection Details widget on the Neon Dashboard, select a branch, a user, and the database you want to connect to. A connection string is constructed for you.
The connection string includes the user name, password, hostname, and database name.
Copy the hostname. In the example above, the hostname is this part of the connection string:
Also, make note of the user, password, and database name. You will need those details when you configure a connection from your application to PolyScale.
Create a PolyScale cache
A PolyScale account can have one or more caches. A cache identifies a database by the hostname and port number. Typically, you create one cache per database.
To create the database cache:
-
Log into PolyScale. If you do not have an account, you can create one by logging in with your GitHub or Google account. PolyScale has a free tier and does not require a credit card to sign up.
-
If you have just signed up for PolyScale, select Create new cache from the Welcome to PolyScale dialog. If you already have a PolyScale account, click the New Cache button in the upper right corner of the PolyScale dashboard.
-
Enter a name for the cache, select
PostgreSQL
as the type, enter the Neon hostname you copied earlier, and enter the database port number. Neon uses the default Postgres port,5432
. Leave the default values for the other settings. The Caching setting enables the database query cache, so this setting should remain enabled. -
Click Create. PolyScale creates a cache for your Neon database and provides a new Connection URI to use in your application in place of the Neon connection string. Simply replace
[USERNAME]
,[PASSWORD]
, and[DATABASE]
with the values from your Neon connection string.note
The Neon serverless driver is not compatible with a PolyScale integration, as it only supports a direct connection to a Neon database. Use a standard Postgres driver such as
node-postgres
instead.
After queries from your application start passing through PolyScale, you can monitor traffic and caching behavior on the Observability tab in PolyScale. For more information, see Observability, in the PolyScale documentation.
By default, PolyScale automatically caches all queries that pass through the platform. That means you can connect to PolyScale, and any queries you run will be cached.
PolyScale identifies caching opportunities by recognizing and remembering patterns in query traffic. New queries typically begin to see cache hits on or about the third query. For more information, see Time To First Hit, in the PolyScale documentation.
For more information about using PolyScale and how it works, refer to the PolyScale documentation.
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more detail, see Getting Support.
Last updated on