I am not able to understand concept and usage of schema in PostgreSQL. I have no idea how it can affect my database design. Why should I use it?

Can it affect me in future if I decide to not think about them right now and worry about them later?

Explanation with an example will be nice.

1 Answer 1


Schemas in postgres are used mostly for namespacing and sometimes for security.

Namespacing because two objects can have the same name in different schemas, and are then referenced by schema.object notation - especially useful in conjunction with search_path (many contrib modules do this, eg xml2). Security because you can now do grant ... on all tables in schema.

  • 3
    One of the very cool things you can do with schemas is to replace default objects from other projects. for instance we use wikis in individual schemas and a view to allow for wikimedia integration with our app at work. to the wikimedia code, it's just regular old wikimedia in a schema, but in fact the users and groups come from our app, and override what wikimedia would expect to see. this way the user / group info isn't stored twice, once in our app and once in wikimedia, but just in our app. Oct 23, 2011 at 4:08
  • I like that :-) Oct 23, 2011 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.