A schema is a collection of database objects (e.g. tables, views, stored procedures, …) that enables easier organization and access control.
In SQL Server, the default schema is dbo
, which stands for “database owner.” SQL Server treats schema the same as a regular database. Meanwhile, in PostgreSQL, schema is a subdivision or namespace of a database, so we might create a user
schema with tables related to user management. PostgreSQL schemas can also be used for multi-tenant data isolation—each tenant is a schema (you would have to recreate necessary tables for new tenants).