Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 13 down vote accepted

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.

share|improve this answer
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. – Scott Marlowe Oct 23 '11 at 4:08
I like that :-) – Jack Douglas Oct 23 '11 at 18:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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