Grouping objecs in PostgreSQL database <p>I inherited a project with a large Postgres database (over 150 tables, over 200 custom types, almost 1000 functions, triggers, etc.) Unfortunately, everything is dumped into one schema (<code>public</code>). It works just fine from the point of view of the application, however it's a major nightmare to maintain.</p> <p>The obvious thing would be to split these objects into separate schemas by function (e.g. all supplier-related stuff goes into <code>supplier</code> schema, all admin related stuff into <code>admin</code> schema, etc.). Once this is done, of course, some changes (ok, a lot of changes) to the code would be required to refer to the new schemas. Considering that the web application contains about 2000 php files, it may be quite a task. Again, as every php in the system already starts with <code>require_once('controller/config.php');</code> I could add a call there to set search path to include all the new schemas: <code>SET search_path = 'public, supplier, admin, ...'</code>, yet somehow subconsciously I don't like this solution.</p> <p>Is there any other way to deal with issue? I don't want to spend more effort than absolutely necessary on reorganising the database. I also can barely incur any downtime on the main web site, as it's used by clients across the world (Australia, Europe, North America).</p> <p>What would your recommend I do? </p>