Hostname and Port
To connect any database client application to PolyScale, firstly, update the
database hostname to use the domain
psedge.global. Select the appropriate port
based on the database type:
- SQL Server
Finally, any database client must specify a PolyScale cache identifier
(found in the user interface under the cache
Settings tab or via the API).
This tells PolyScale which cache to use and therefore which upstream database to
connect to. The method of how this is specified as part of the database
connection credentials is database specific. See below for details on each
MySQL, MariaDB and SQL Server
To connect to a MySQL, MariaDB or SQL Server database via PolyScale, a database
username must be provided that contains the polyscale
cache identifier. The cache id can be found under the
Settings tab of each cache within the user interface.
Simply prepend the cache id to the origin database username, separated by a hyphen.
If the username provided by PolyScale is
abc and the origin database username
foobar, the database username to connect via PolyScale would be
Testing MySQL Connectivity
mysql -h psedge.global \
-u [cacheid]-[dbuser] \
For PostgreSQL databases, PolyScale supports two options for passing the
cache identifier as part of the connection string. If you
have access to the Postgres connection URI (typically this is an environment
variable for web applications, microservices etc.), an additional
application_name parameter is appended to the connection string (see
Option 1 below).
Sometimes it's not possible to modify the connection URI, such as in desktop tools where a UI dictates the available parameters. In these situations a specific database username can be created that is utilized by PolyScale (see Option 2 below).
Option 1 - Append application_name
application_name parameter to the connection string containing the
PolyScale cache identifier. The cache id can be found under the
of each cache within the user interface.
application_name key with the PolyScale cache id value to the
If it is required to use the
application_name property, simply prepend the
PolyScale cache id to the desired application name separated by a hyphen and it
will be passed to the PostgreSQL server as normal.
Option 2 - Database Username
PolyScale can also use a cache identifier specified as the database username. In this case, a database user must be created with a username identical to the cache id provided by PolyScale.
For example, if the cache id is
CREATE USER "8255a89a-4365-4e64-8e78-38db272d8fdd" WITH ENCRYPTED PASSWORD 'foo';
GRANT ALL PRIVILEGES ON DATABASE employees TO "8255a89a-4365-4e64-8e78-38db272d8fdd";
string. This can be useful for identifying PolyScale database users.
For example, if the cache ID was
database user could be named
When creating a database user and granting privileges, be sure to only grant the minimum needed for the purpose.
Testing PostgreSQL Connectivity
psql "host=psedge.global \
To connect to MongoDB via PolyScale, an
appName parameter is appended to the connection string
and the cache identifier is passed as the value. Two additional parameters must
also be passed:
PolyScale supports all versions (release 5.0 or later) of MongoDB including MongoDB Atlas.
When connecting to a MongoDB cluster, PolyScale handles navigating which machine on the cluster to connect to. It is important to include the
directConnection=true parameter. The MongoDB protocol relies on the client side to be aware of, and continuously observe changes in the cluster configuration. By using this parameter, you ensure that your connection goes directly to PolyScale and then PolyScale manages which upstream server to connect to for writes and non-cached reads.
Queries should be made as they would directly to the underlying GraphQL server, but replacing the host with psedge.global
Eg: https://yourgraphqlserver.com/graphql → https://psedge.global/graphql
The endpoint is
psedge.global. Include a header of:
x-polyscale-cacheid with a value of the cache id.