Skip to content

sys.schema

A system view that returns information about the schemas in the database.

Column NameData TypeDescription
schema_idbigintUnique ID of the schema. User-defined schemas have IDs greater than 16000.
database_idbigintUnique ID of the database where the schema belongs. This view returns schemas for all databases.
namevarchar(256)Name of the schema.
owner_idbigintUnique ID of the user who owns the schema. Join to sys.user to get the name of the user.
creation_timetimestamptzWhen the schema was created. NULL for sys and public schemas.
max_size_bytesbigintMaximum size of schema set by the quota. NULL if no disk usage limit is set.

For example:

yellowbrick=# select * from sys.schema order by 4,2,1;
 schema_id | database_id | owner_id |    name     |         creation_time         | max_size_bytes 
-----------+-------------+----------+-------------+-------------------------------+----------------
    16552 |       16520 |    16007 | premdb_bobr | 2020-10-26 14:41:36.499661-07 |         [NULL]
    16553 |       16520 |    16007 | premdb_test | 2020-10-26 14:44:52.985893-07 |         [NULL]
     2200 |        4400 |       10 | public      | [NULL]                        |         [NULL]
     2200 |       16392 |       10 | public      | [NULL]                        |         [NULL]
     2200 |       16393 |       10 | public      | [NULL]                        |         [NULL]
     2200 |       16520 |       10 | public      | [NULL]                        |         [NULL]
     3300 |        4400 |       10 | sys         | [NULL]                        |         [NULL]
     3300 |       16392 |       10 | sys         | [NULL]                        |         [NULL]
     3300 |       16393 |       10 | sys         | [NULL]                        |         [NULL]
     3300 |       16520 |       10 | sys         | [NULL]                        |         [NULL]
(10 rows)

Parent topic:System Views