简体   繁体   中英

Postgres- Golang- Schema vs Database ?

I am using golang and Postgres for my application. In my application, For new user am creating new database and tables for that user.So for Each and every new customer, am creating new database. while processing in my application, am going to make too many connection to connect particular user database..This is now currently am doing. My Question is , Whether i have to create schema for new user instead of databases in postgres, to reduce connection. In this case, Only one database is created under the database,too many schema will created. This is best way or not.

If the schema for each customer is different then you should use Event Based data storage, in which instead of creating columns for every field create rows.

Each row in this case consists of 4 fixed columns: id (unique for each entry), res_id (points to its parent id field if present), key (ex-"user_id"), value (ex-"1").

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