Yo, I heard you liked databases, so we put logical databases in your database cluster so you can database while you databaseThe goalSay we want to run multiple applications with distinct schemas. Let's start with two classic side project app ideas: a blog and a to-do list.PlanetScale Postgres clusters start at $5/month, but this doesn't mean you have to create a new one for every new app idea. A single database cluster can contain many logical databases.However, orchestrating logical databases and the roles that connect to them gets complicated fast. We can automate away the complexity, but let's first understand how they work.NoteRunning multiple small applications from a single database cluster is great for spikes and side projects. When you need to scale an application to thousands of users, it's best to use dedicated Postgres clusters.DefinitionsDatabase cluster: The shared Postgres instance (compute, storage, connection endpoint) of a single branch. Apps connect to the cluster via a connection string.Branch: An isolated Postgres environment inside that cluster (e.g. main). Connection credentials are scoped to a branch. Role usernames include the branch's ID (e.g. <role-id>.<branch-id>).Logical database: A named Postgres database within a cluster (e.g. blog, todo) with its own schema and data. Logical databases share the branch's compute, storage, and connection limits.Role: A unit of access control: a username, password, and permissions.About logical databasesA new managed Postgres instance likely already contains a few logical databases, primarily for administration. In a fresh PlanetScale Postgres database, you may see multiple logical databases owned by pscale_admin and pscale_superuser.If you're using pgcli, you can list all logical databases with \l, the output should look something like this:pg> \l
One Postgres cluster, many apps — PlanetScale
Yo, I heard you liked databases, so we put logical databases in your database cluster so you can database while you database
2,332 words~11 min read







