In PostgreSQL the system determines which table is meant by following a search path, which is a list of schemas to look in.

The first matching table in the search path is taken to be the one wanted, otherwise, if there is no match a error is raised, even if matching table names exist in other schemas in the database.

To show the current search path you can use the following command:

SHOW search_path;

And to put the new schema in the path, you could use:

SET search_path TO myschema;

Or if you want multiple schemas:

SET search_path TO myschema, public;

Reference: https://www.postgresql.org/docs/current/static/ddl-schemas.html

Answer from Ciro Pedrini on Stack Overflow
🌐
PostgreSQL
postgresql.org › docs › current › ddl-schemas.html
PostgreSQL: Documentation: 18: 5.10. Schemas
May 14, 2026 - Remove the public schema from the default search path, by modifying postgresql.conf or by issuing ALTER ROLE ALL SET search_path = "$user". Then, grant privileges to create in the public schema. Only qualified names will choose public schema objects. While qualified table references are fine, calls to functions in the public schema will be unsafe or unreliable.
🌐
Medium
cybernerdie.medium.com › postgresql-schemas-explained-the-missing-tool-for-clean-scalable-database-design-f6980622528e
PostgreSQL Schemas Explained: The Missing Tool for Clean, Scalable Database Design | by Joshua Idunnu Paul | Medium
January 7, 2026 - If you believe in bounded contexts, schemas feel like a natural fit. Let’s be honest. Prefixes are a workaround. ... SELECT * FROM trello_users tu JOIN asana_users au ON ... ... SELECT * FROM trello.users tu JOIN asana.users au ON ... One of these scales better in your head. You know which one. PostgreSQL resolves objects using search_path.
🌐
Reddit
reddit.com › r/postgresql › can someone help me understand schemas and how they relate to databases?
r/PostgreSQL on Reddit: Can someone help me understand schemas and how they relate to databases?
November 3, 2021 -

I've been using PostgreSQL for over 15 years and yet I never fully understood the term schema or how namespaces are used. This causes some confusion when reading docs.

I understand the general concept of namespaces but first of all is schema just a word for namespace?

Can existing databases be configured with namespaces, can they use multiple namespaces?

Is this valuable for security if you can configure users to have access to the databases in a certain namespace without giving them access to databases?

Top answer
1 of 4
12
I understand the general concept of namespaces but first of all is schema just a word for namespace? Yes. Specifically, schemas are the implementation in postgres of the namespace concept. Any of the objects defined in a database (tables, views, indexes, sequences, etc.) are defined within a schema within the database. By default objects are created in the public schema, but you can have as many named schemas as you want and organize the database objects into those schemas. Can existing databases be configured with namespaces, can they use multiple namespaces? Yes, you can add schemas to a database. For the new schema to be useful you will need to create some objects (e.g. tables) in it, or move some objects into it. For example you can use alter table ... set schema .... to move an existing table to a different schema. Is this valuable for security if you can configure users to have access to the databases in a certain namespace without giving them access to databases? Yes, although schemas exist within a database, not the other way around. Mostly security permissions are assigned to individual objects. It is possible though to assign a privilege for all objects (e.g. tables) in a particular schema to a particular role, so in that way you're right that it can be helpful to managing security permissions.
2 of 4
5
Server -> Cluster -> Database -> Schema -> Object -> (can contain multiple) Because a server often only has a single cluster the term server and cluster tend to get used interchangeably. The word schema has alternate usage. In particular the "schema of a database" is often used to mean "the definitions of all objects in the database". The schemas (namespaces) those objects are created in are component details of the singular "schema" that is the overall design of the database. Different database systems have their own slightly different meanings implied when these terms are used; especially since both cluster and schema are largely PostgreSQL implementation details.
🌐
Arkency
blog.arkency.com › multitenancy-with-postgres-schemas-key-concepts-explained
Multitenancy with Postgres schemas: key concepts explained | Arkency Blog
October 7, 2020 - So far we accessed other schemas by using their fully qualified name: schema_name.table_name. If we skip the schema name, the default schema is used — public. Now, search_path is a Postgres session variable that determines which schema is the default one.
🌐
Reddit
reddit.com › r/postgresql › how are folks using schemas?
r/PostgreSQL on Reddit: How are folks using schemas?
January 7, 2024 -

Hi PostgreSQL subreddit,

I'm curious how folks are leveraging schemas, and preferably an at-scale use case/example.

I my several years, and handful of companies, of software engineering, I've only had to work with a simple public schema, and it has worked fine, but I'm curious how others are using schemas, if at all.

Thanks in advance!

🌐
DB Vis
dbvis.com › thetable › schemas-in-postgresql
Schemas in PostgreSQL: Best Practices of PostgreSQL Schemas
March 11, 2024 - This implies that only authorized users can access this type of schema and the objects within them. To create a custom schema, replace schema_name with your desired schema name and execute the following statement: ... This will create a schema with the specified name in the schema tab of your database as shown in DbVisualizer below: ... Great! 👏 we’ve been able to successfully create a custom schema in our PostgreSQL database.
Find elsewhere
🌐
PostgreSQL
postgresql.org › docs › current › sql-createschema.html
PostgreSQL: Documentation: 18: CREATE SCHEMA
May 14, 2026 - July 16, 2026: PostgreSQL 19 Beta 2 Released! ... Unsupported versions: 13 / 12 / 11 / 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 ... CREATE SCHEMA schema_name [ AUTHORIZATION role_specification ] [ schema_element [ ...
🌐
CommandPrompt Inc.
commandprompt.com › education › how-do-i-setchange-the-default-schema-in-postgresql
How Do I Set/Change the Default Schema in PostgreSQL — CommandPrompt Inc.
March 2, 2023 - In PostgreSQL, the “SET SEARCH_PATH” command is used to change a schema temporarily. To change a schema permanently at the database level or user lever, the “ALTER DATABASE” and "ALTER USER" commands are used with the “SET SEARCH_PATH” command, respectively.
Address   2950 Newmarket ST STE 101 - 231, 98226, Bellingham
🌐
IONOS
ionos.com › digital guide › server › configuration › postgresql schema
How to use PostgreSQL schemas
July 29, 2025 - To create a new schema in Post­greSQL, you can use the CREATE SCHEMA command. To delete a schema, use the DROP SCHEMA command.
Top answer
1 of 2
12

What you're seeing is mostly one user interface's way of displaying the structure of a PostgreSQL database.

If you were using pgAdminIII, which is just another administrative interface, each database would usually show two "catalogs": information_schema and pg_catalog. It would also have a schema named "public".

Database objects named "pg_*" are system objects. The pg_toast schema holds TOAST storage for large tables.

The information_schema views are part of the SQL standard. They're supposed to provide a vendor-independent way to determining information that's stored in vendor-specific system tables.

You can make a good case for not exposing every namespace as if it were a user-level schema. (Internally, these are namespaces. Try select * from pg_namespace;.) The only schema in a newly created database that really matters to users is "public".

2 of 2
8

If you keep the default search_path and use the default schema public (automatically), you don't have to bother with schemas at all.

But if your database grows, chances are you will happily make use of them to organize objects and privileges. By setting the search_path per user / database / session / ... you can manage schemas precedence any way you want. I have assembled a couple of ways to do this in this related answer on SO.

Schemas are much like directories in the file system:
If you don't schema-qualify an object name (myschema.mytable), the first schema in your search_path is assumed when creating objects. That's like the "current directory" in the file system.

All schemas in the search_path are searched in sequence when using objects. Just like with a search path in the file system.

But:
There is no "root schema", and no nesting. You can't store anything "without schema". Every object is created inside a particular schema. (Except special objects on the database-cluster level, like roles and databases.)

The current role needs privileges to access a schema. Schemas are extremely useful if you want to organize things and still be able to access other "areas" in a simple query.

MySQL does not have anything similar. You would use a separate database for many things solved with a separate schema in PostgreSQL.

🌐
PostgreSQL
postgresql.org › docs › current › information-schema.html
PostgreSQL: Documentation: 18: Chapter 35. The Information Schema
May 14, 2026 - ... Unsupported versions: 13 / ... 8.1 / 8.0 / 7.4 ... The information schema consists of a set of views that contain information about the objects defined in the current database....
🌐
CYBERTEC PostgreSQL
cybertec-postgresql.com › home › what is a schema in postgresql?
What is a schema in PostgreSQL? | CYBERTEC PostgreSQL | Services & Support
April 1, 2026 - By using a schema name as a prefix to the table name, you can define the schema you want to use. Mind that the schema itself does NOT impact the way data is stored. The data files associated with our table are still in the same PostgreSQL data directory. Therefore schemas do not impact performance and are not about storage optimization.
🌐
GeeksforGeeks
geeksforgeeks.org › postgresql › postgresql-schema
PostgreSQL - Schema - GeeksforGeeks
July 15, 2025 - By default, PostgreSQL creates a schema named public in every new database. Any object created without explicitly specifying a schema is placed in the public schema. ... To access an object within a schema, users need to qualify its name with the schema name as a prefix:
🌐
Mydbops
mydbops.com › blog › postgresql-schema-guide
PostgreSQL Schema Guide: Structure, Security & | Mydbops
October 22, 2025 - The public schema is the default schema in PostgreSQL. If we create a table or any object without specifying a schema, it is placed in the public schema. ... SELECT schemaname, tablename FROM pg_tables WHERE tablename = 'users'; schemaname | ...
🌐
DB Vis
dbvis.com › thetable › create-schema-postgresql-statement-what-why-when-to-use
CREATE SCHEMA PostgreSQL Statement: What, Why & When to Use
October 30, 2024 - To create a table inside of the schema we just created (demo_schema), we will use an SQL query like so: ... 1 CREATE TABLE demo_schema.products ( 2 product_id INT primary key, 3 product_title CHARACTER (50), 4 customer CHARACTER (50) 5 ); ... PostgreSQL is a very interesting beast — so interesting, in fact, that it can provide you with all the schemas in itself after you run a single query.
🌐
Temporal
community.temporal.io › community support
Postgres schema - Community Support - Temporal Community Forum
October 27, 2021 - Hi, We are using a customized schema instead of ‘public’ in postgres, does temporal-sql-tool support to pass a schema param? I believe even i am able to create tables in my own schema, the temporal services will not abl…