Postgres DB

Overview

MOSIP uses Postgres DB for all relational data storage. The DB creation SQL scripts are located under /db_scripts the folder of the module repository. In sandbox deployment, Postgres is installed as a docker inside the cluster. However, in production deployment, typically, Postgres will be installed external to the cluster.

ER diagrams

Entity relationships diagrams for all databases used in MOSIP are given below.

Configuration parameters

  • Connection details

    • {module_name}_database_url

    • {module_name}_database_username

    • {module_name}_database_password

  • Hibernate configurations

    • javax.persistence.jdbc.driver

    • hibernate.dialect

    • hibernate.jdbc.lob.non_contextual_creation

    • hibernate.hbm2ddl.auto

    • hibernate.show_sql

    • hibernate.format_sql

    • hibernate.connection.charSet

    • hibernate.cache.use_second_level_cache

    • hibernate.cache.use_query_cache

    • hibernate.cache.use_structured_entries

    • hibernate.generate_statistics

    • logging.level.org.hibernate.SQL

    • logging.level.org.hibernate.type

Production DB configuration

These are some of the reference settings of a production database. It is expected that these are reviewed and finalized for a given deployment.

resources: 
  limits: {}
  #   cpu: 250m
  #   memory: 1Gi
  requests: 
    cpu: 8000m
    memory: 32000Mi

postgresqlExtendedConf:                 
   wal_level: logical
   max_wal_senders: 20
   max_replication_slots: 10
   shared_buffers: 16GB                         
   max_prepared_transactions: 1000
   huge_pages: try                              
   work_mem: 16MB                       # min 64kB
   maintenance_work_mem: 3GB            # min 1MB
   effective_cache_size: 32GB                   
   log_min_duration_statement: 1000

Last updated

Copyright © 2021 MOSIP. This work is licensed under a Creative Commons Attribution (CC-BY-4.0) International License unless otherwise noted.