Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of PostgreSQL Database (3)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

System: Ubuntu 16.04.4 LTS PostgreSQL Database: PostgreSQL 10.5varchar (80) specifies a data type that can store any string up to 80 characters in length. Int is a normal integer type. Real is a type for storing single-precision floating-point numbers. Create database: $/ data/services/postgresql9/bin/createdb databasename access database: $/ data/services/postgresql9/bin/psql databasename install command line tool: # python3-m pip install pgcli connect to PostgreSQL database: # pgcli-h localhost-p 5432-U postgres-W View current database: postgres=# select current_database () View the version of PostgreSQL: SELECT version () View date: SELECT current_date; reads SQL statement from text: COPY tablename FROM 'SQL file path'; server configuration and operation: run PostgreSQL database service with postgres user. 1. Manage kernel resources: shared memory and semaphores: maximum size of SHMMAX shared memory segments (bytes) the minimum size of SHMMIN shared memory segments (bytes) up to 32 bytes. Total SHMALL available shared memory (bytes or pages) SHMSEG maximum number of shared memory segments per process SHMMNI system-wide maximum number of SEMMNI semaphore identifiers (i.e. sets) maximum number of signals within the SEMMNS system Maximum number of semaphores per group SEMMSL maximum number of entries in SEMMAP semaphore mapping maximum value of SEMVMX semaphores PostgreSQL one semaphore per allowed connection (max_connections) Allow autovacuum worker processes (autovacuum_max_workers) and background processes (max_worker_processes), 16 in each group. Linux kernel resources: the default maximum segment size is 32 MB and the default maximum total size is 2097152 pages. The page is almost always 4096 bytes. Change the shared memory size setting: $sysctl-w kernel.shmmax=17179869184$ sysctl-w kernel.shmall=4194304 limits overuse of memory: sysctl-w vm.overcommit_memory = 2 or: echo -1000 > / proc/self/oom_score_adj can also change the contents of the / proc file system: $echo 17179869184 > / proc/sys/kernel/shmmax $echo 4194304 > / proc/sys/kernel/shmall resource limit: / etc/security/limits.conf controls the various resource limits set during login / proc/sys/fs/file-max determines the maximum number of open files that the kernel will support. # cat / data/services/postgresql9/postgresql.pid 110460 check the VmPeak value of postmaster: # grep ^ VmPeak / proc/110460/status system large page size: # grep ^ Hugepagesize / proc/meminfo set large page size: sysctl-w vm.nr_hugepages=3170 sets vm.hugetlb_shm_group through sysctl And / or grant permission to lock memory using ulimit-l. Large pages in PostgreSQL: # cat / data/services/postgresql9/data/postgresql.conf huge_pages = on

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report