Reputation: 644
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.
Upvotes: 0
Views: 1095
Reputation: 992
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").
Upvotes: 0