This is a discussion on How to organize users, documents and premissions for BEST PERFORMANCE within the Pgsql Performance forums, part of the PostgreSQL category; --> Hi! I need to prepare a DB design with users, documents and permissions. The average values will be: Number ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi! I need to prepare a DB design with users, documents and permissions. The average values will be: Number of USERS: 10 000 Number of DOCUMENTS: Type 1: 300 000 Type 2: 750 000 Type 3: 800 000 All document types have common 'header' data I prefer to follow MS Windows permissions schema as follows: 1. Organize USERS in GLOBAL GROUPS 2. Put GLOBAL GROUPS in LOCAL GROUPS 3. Give document PERMISSIONS to both USERS and LOCAL GROUPS In this case: The average values will be: Number of LOCAL GROUPS: 200 Number of GLOBAL GROUPS: 50 Number of PERMISSIONS: 50 I prepared the neccessery index files - all tables are indexed. I prepared some views: 1. users, global groups and local groups 2. users, documents and permissions UNION ALL users, global groups, local groups, documents and permissions Questions: 1. Is this the prefered schema for users, documents and permissions? 2. I prepared the schema and it works VERY SLOW ;( The problem appeared when I want to list a documents that a certain user have permission to see. It taked a LOT of time. How could I optimize this schema or how to change the schema ? NOTES: Here are the TABLES: ================================================ USERS ~~~~~ Table "t_users" col 1: user_id (sequence) col 2..n: user_data GROUPS ~~~~~~ Table "t_local_groups" col 1: local_groups_id (sequence) col 2..n: local_groups_data Table "t_global_groups" col 1: global_groups_id (sequence) col 2..n: global_groups_data PERMISSION_TYPES ~~~~~~~~~~~~~~~~ Table "t_permission_types" col 1: permission_types_id (sequence) col 2..n: permission_types_data DOCUMENTS ~~~~~~~~~ Table "t_documents" col 1: document_id (sequence) col 2..n: document_data Table "t_doc_type1" col 1: document_id col 2..n: doc_type1_data Table "t_doc_type2" col 1: document_id col 2..n: doc_type2_data Table "t_doc_type3" col 1: document_id col 2..n: doc_type3_data USER & GROUP LINKS ~~~~~~~~~~~~~~~~~~ Table "t_users_global_groups" col 1: user_id col 2: global_groups_id Table "t_global_local_groups" col 1: local_groups_id col 2: global_groups_id PERMISSION LINKS ~~~~~~~~~~~~~~~~ Table "t_documents_persimmsions_local_groups" col 1: local_groups_id col 2: document_id col 3: permission_types_id Table "t_documents_persimmsions_users" col 1: user_id col 2: document_id col 3: permission_types_id ================================================ |
| Thread Tools | |
| Display Modes | |
|
|