Take the 2-minute tour ×
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. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

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.