简体   繁体   中英

PostGIS and PostgreSQL search path

We recently added Geodjango and PostGIS to the system. I see that PostGIS installs itself in the public schema. Now, we are using PostgreSQL schemas for client tenancy, so for example client A will have a schema tenant_A , so we usually set the search path manually:

SET search_path TO tenant_A;

But since PostGIS lives inside the public schema, I will now have to do this:

SET search_path TO tenant_A, public;

Would it ever make sense to simply move the PostGIS tables - or even only the geometry_columns table - into the individual client schemas? The advantage of that would be 1) clients' GIS data would have a greater degree of separation and 2) Tenant-specific maintenance (backup, migrations, etc) would be easier.

That would hardly make sense, since the PostGIS objects are the same for all clients. If every client installs a separate instance, you waste a lot of disk space and also weaken cache efficiency.

If other objects live in the public schema that are of no interest to some clients, it might be an option to install PostGIS to a dedicated schema like postgis and include that in the search_path instead.

If you really want to separate clients rigorously, you'd have to create separate databases or even a db cluster per client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM