PostgreSQL - Knowledge Base Archives - Hivelocity Hosting https://www.hivelocity.net/kb/tag/postgresql/ Dedicated Servers, Private Cloud & Colocation Thu, 07 Dec 2023 14:33:50 +0000 en-US hourly 1 https://wordpress.org/?v=6.6 Manage Tablespaces https://www.hivelocity.net/kb/manage-tablespaces/ https://www.hivelocity.net/kb/manage-tablespaces/#respond Sun, 14 Nov 2010 12:02:06 +0000 https://kb.hivelocity.net/?p=2459 Tablespaces in PostgreSQL allow database administrators to define locations in the file system where the files representing database objects can be stored. Once created, a tablespace can be referred to by name when creating database objects. By using tablespaces, an administrator can control the disk layout of a PostgreSQL installation. This is useful in at …

Manage Tablespaces Read More »

The post Manage Tablespaces appeared first on Hivelocity Hosting.

]]>
Tablespaces in PostgreSQL allow database administrators to define locations in the file system where the files representing database objects can be stored. Once created, a tablespace can be referred to by name when creating database objects.

By using tablespaces, an administrator can control the disk layout of a PostgreSQL installation. This is useful in at least two ways. First, if the partition or volume on which the cluster was initialized runs out of space and cannot be extended, a tablespace can be created on a different partition and used until the system can be reconfigured.

Second, tablespaces allow an administrator to use knowledge of the usage pattern of database objects to optimize performance. For example, an index which is very heavily used can be placed on a very fast, highly available disk, such as an expensive solid state device. At the same time a table storing archived data which is rarely used or not performance critical could be stored on a less expensive, slower disk system.

To define a tablespace, use t

The post Manage Tablespaces appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/manage-tablespaces/feed/ 0
What database software does Hivelocity support? https://www.hivelocity.net/kb/what-database-software-does-hivelocity-support/ https://www.hivelocity.net/kb/what-database-software-does-hivelocity-support/#respond Sun, 14 Nov 2010 11:45:03 +0000 https://kb.hivelocity.net/?p=2518 Hivelocity supports Microsoft SQL server AKA MSSQL , PostgreSQL , and MYSQL.

The post What database software does Hivelocity support? appeared first on Hivelocity Hosting.

]]>
Hivelocity supports Microsoft SQL server AKA MSSQL , PostgreSQL , and MYSQL.

The post What database software does Hivelocity support? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/what-database-software-does-hivelocity-support/feed/ 0
Why should I disable autocommit while dumping a database? https://www.hivelocity.net/kb/why-should-i-disable-autocommit-while-dumping-a-database/ https://www.hivelocity.net/kb/why-should-i-disable-autocommit-while-dumping-a-database/#respond Sun, 14 Nov 2010 11:42:30 +0000 https://kb.hivelocity.net/?p=2461 Turn off autocommit and just do one commit at the end. (In plain SQL, this means issuing BEGIN at the start and COMMIT at the end) If you allow each insertion to be committed separately, PostgreSQL is doing a lot of work for each row that is added. An additional benefit of doing all insertions …

Why should I disable autocommit while dumping a database? Read More »

The post Why should I disable autocommit while dumping a database? appeared first on Hivelocity Hosting.

]]>
Turn off autocommit and just do one commit at the end. (In plain SQL, this means issuing BEGIN at the start and COMMIT at the end) If you allow each insertion to be committed separately, PostgreSQL is doing a lot of work for each row that is added. An additional benefit of doing all insertions in one transaction is that if the insertion of one row were to fail then the insertion of all rows inserted up to that point would be rolled back, so you won’t be stuck with partially loaded data.

The post Why should I disable autocommit while dumping a database? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/why-should-i-disable-autocommit-while-dumping-a-database/feed/ 0
How does memory overcommit affect PostgreSQL? https://www.hivelocity.net/kb/how-does-memory-overcommit-affect-postgresql/ https://www.hivelocity.net/kb/how-does-memory-overcommit-affect-postgresql/#respond Sun, 14 Nov 2010 11:42:16 +0000 https://kb.hivelocity.net/?p=2460 In Linux 2.4 and later, the default virtual memory behavior is not optimal for PostgreSQL. Because of the way that the kernel implements memory overcommit, the kernel may terminate the PostgreSQL server (the postmaster process) if the memory demands of another process cause the system to run out of virtual memory. If this happens, you …

How does memory overcommit affect PostgreSQL? Read More »

The post How does memory overcommit affect PostgreSQL? appeared first on Hivelocity Hosting.

]]>
In Linux 2.4 and later, the default virtual memory behavior is not optimal for PostgreSQL. Because of the way that the kernel implements memory overcommit, the kernel may terminate the PostgreSQL server (the postmaster process) if the memory demands of another process cause the system to run out of virtual memory.

If this happens, you will see a kernel message
Out of Memory: Killed process 12345 (postmaster).

This indicates that the postmaster process has been terminated due to memory pressure. Although existing database connections will continue to function normally, no new connections will be accepted. To recover, PostgreSQL will need to be restarted.

One way to avoid this problem is to run PostgreSQL on a machine where you can be sure that other processes will not run the machine out of memory.

On Linux 2.6 and later, a better solution is to modify the kernel’s behavior so that it will not “overcommit” memory. This is done by selecting strict overcommit mode via sysctl:

sysctl -w vm.overcommit_memory=2

or placing an equivalent entry in /etc/sysctl.conf. You may also wish to modify the related setting vm.overcommit_ratio. For details see the kernel documentation file Documentation/vm/overcommit-accounting.

The post How does memory overcommit affect PostgreSQL? appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-does-memory-overcommit-affect-postgresql/feed/ 0
Create PostgreSQL user account https://www.hivelocity.net/kb/create-postgresql-user-account/ https://www.hivelocity.net/kb/create-postgresql-user-account/#respond Sun, 14 Nov 2010 11:41:31 +0000 https://kb.hivelocity.net/?p=2426 It is advisable to run PostgreSQL under a separate user account. This user account should only own the data that is managed by the server, and should not be shared with other daemons. (For example, using the user nobody is a bad idea.) It is not advisable to install executables owned by this user because …

Create PostgreSQL user account Read More »

The post Create PostgreSQL user account appeared first on Hivelocity Hosting.

]]>
It is advisable to run PostgreSQL under a separate user account. This user account should only own the data that is managed by the server, and should not be shared with other daemons. (For example, using the user nobody is a bad idea.) It is not advisable to install executables owned by this user because compromised systems could then modify their own binaries.

To add a Unix user account to your system, look for a command useradd or adduser. The user name postgres is often used, and is assumed throughout this book, but you can use another name if you like.

The post Create PostgreSQL user account appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/create-postgresql-user-account/feed/ 0
Install PostgreSQL from source https://www.hivelocity.net/kb/install-postgresql-from-source/ https://www.hivelocity.net/kb/install-postgresql-from-source/#respond Sun, 14 Nov 2010 11:41:19 +0000 https://kb.hivelocity.net/?p=2507 The following are the commands for installing PostgreSQL from source, refer to the INSTALL file for explanation of each: ./configure gmake su gmake install adduser postgres mkdir /usr/local/pgsql/data chown postgres /usr/local/pgsql/data su - postgres /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 & /usr/local/pgsql/bin/createdb test /usr/local/pgsql/bin/psql test

The post Install PostgreSQL from source appeared first on Hivelocity Hosting.

]]>
The following are the commands for installing PostgreSQL from source, refer to the INSTALL file for explanation of each:

./configure
gmake
su
gmake install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test

The post Install PostgreSQL from source appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/install-postgresql-from-source/feed/ 0
Service Manager https://www.hivelocity.net/kb/service-manager/ https://www.hivelocity.net/kb/service-manager/#respond Sun, 14 Nov 2010 07:15:17 +0000 https://kb.hivelocity.net/?p=2118 Overview The Service Manager area enables you to start and stop available services on your server. The following services are available:   antirelayd – The Daemon controlling POP before SMTP clamd – ClamAV Virus Scanner entropychat – cPanel’s HTML-based Chat Server exim – SMTP Server eximstats – Daemon that monitors SMTP Bandwidth usage. httpd – …

Service Manager Read More »

The post Service Manager appeared first on Hivelocity Hosting.

]]>
Overview

The Service Manager area enables you to start and stop available services on your server. The following services are available:

 

  • antirelayd – The Daemon controlling POP before SMTP
  • clamd – ClamAV Virus Scanner
  • entropychat – cPanel’s HTML-based Chat Server
  • exim – SMTP Server
  • eximstats – Daemon that monitors SMTP Bandwidth usage.
  • httpd – Web Server (Apache)
  • interchange – Shopping Cart (E-Commerce) Server
  • melange – Java-based Chat Server
  • mysql – mySQL Database Server
  • named – name server (BIND)
  • pop – POP3 Mail Server
  • postgresql – PostgreSQL Database Server
  • spamd – SpamAssassin server

NOTE: If you choose to disable this, you need to disable the SpamAssassin option from all customers as well. Refer to Tweaking Settings for more information on disabling this setting.

  • syslogd – Daemon for logging system issues / activity.
  • tomcat – Tomcat JSP Server (if installed).
  • exim on another port – Run another copy of exim on a different port number, as some providers block 25, the standard port number.

The post Service Manager appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/service-manager/feed/ 0
Restart Services https://www.hivelocity.net/kb/restart-services/ https://www.hivelocity.net/kb/restart-services/#respond Sun, 14 Nov 2010 06:39:28 +0000 https://kb.hivelocity.net/?p=2041 You can restart any of the available services on the web server at any time. You can restart the following services: Mail Server (Exim) DNS/Name Server (BIND) FTP Server (ProFTPd) SQL Server (MySQL) SSH Server (OpenSSH) HTTP/Web Server (Apache) POP3 Server (cppop) IMAP Server (uwimap) E-Commerce Server (interchange) Postgresql Server Servlet Server (tomcat)

The post Restart Services appeared first on Hivelocity Hosting.

]]>
You can restart any of the available services on the web server at any time. You can restart the following services:
Mail Server (Exim)
DNS/Name Server (BIND)
FTP Server (ProFTPd)
SQL Server (MySQL)
SSH Server (OpenSSH)
HTTP/Web Server (Apache)
POP3 Server (cppop)
IMAP Server (uwimap)
E-Commerce Server (interchange)
Postgresql Server
Servlet Server (tomcat)

The post Restart Services appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/restart-services/feed/ 0
Take postgresql database backup https://www.hivelocity.net/kb/how-to-take-postgresql-database-backup/ https://www.hivelocity.net/kb/how-to-take-postgresql-database-backup/#respond Sun, 14 Nov 2010 05:05:22 +0000 https://kb.hivelocity.net/?p=1965 Following commands also useful to take backup and restore of simple (not contains large objects) postgresql database. pg_dump mydb > db.out To restore database psql -d database -f db.out

The post Take postgresql database backup appeared first on Hivelocity Hosting.

]]>
Following commands also useful to take backup and restore of simple (not contains large objects) postgresql database.
pg_dump mydb > db.out
To restore database
psql -d database -f db.out

The post Take postgresql database backup appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-take-postgresql-database-backup/feed/ 0
Restore and take Backups of Database from shell https://www.hivelocity.net/kb/how-to-restore-and-take-backups-of-database-from-shell/ https://www.hivelocity.net/kb/how-to-restore-and-take-backups-of-database-from-shell/#respond Sun, 14 Nov 2010 05:02:58 +0000 https://kb.hivelocity.net/?p=1961 Postgresql Using following command you can take backup of postgresql database. # pg_dump -u -C -f backupfile.sql database_name You can restore pgsql database using following command # pg_restore -v -C -O -d database_name backupfile.sql.tar Mysql Using following command you can take backup of mysql database. # mysqldump database_name > backup.sql You can restore mysql database …

Restore and take Backups of Database from shell Read More »

The post Restore and take Backups of Database from shell appeared first on Hivelocity Hosting.

]]>

Postgresql

Using following command you can take backup of postgresql database.

# pg_dump -u -C -f backupfile.sql database_name

You can restore pgsql database using following command

# pg_restore -v -C -O -d database_name backupfile.sql.tar

Mysql

Using following command you can take backup of mysql database.

# mysqldump database_name > backup.sql

You can restore mysql database using following command

# mysql database_name

The post Restore and take Backups of Database from shell appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/how-to-restore-and-take-backups-of-database-from-shell/feed/ 0
Installing Postgresql https://www.hivelocity.net/kb/installing-postgresql/ https://www.hivelocity.net/kb/installing-postgresql/#respond Sun, 14 Nov 2010 04:41:00 +0000 https://kb.hivelocity.net/?p=1937 Installing Postgresql – HOWTO cPanel requires Postgresql 7.3.x or later. 7.2.x will not work. =========================================== Step 1 =========================================== Upgrade to cPanel 7.4.0 build 45 or later =========================================== =========================================== Step 1a (If you do not have 7.2.x or earlier installed skip this step) =========================================== Login to a root shell via ssh or the console. If you …

Installing Postgresql Read More »

The post Installing Postgresql appeared first on Hivelocity Hosting.

]]>
Installing Postgresql – HOWTO
cPanel requires Postgresql 7.3.x or later. 7.2.x will not work.

===========================================
Step 1
===========================================
Upgrade to cPanel 7.4.0 build 45 or later
===========================================

===========================================
Step 1a (If you do not have 7.2.x or earlier installed skip this step)
===========================================
Login to a root shell via ssh or the console.

If you have Postgres 7.2.x installed, backup your databases using pg_dumpall or some other method.

Move the postgres data directory somewhere else. ie

mv /var/lib/pgsql /var/lib/pgsql.old
===========================================

===========================================
Step 2
===========================================
Login to a root shell via ssh or the console and run

/scripts/installpostgres
===========================================

===========================================
Step 2a (skip this step if you are not upgrading from postgres 7.2 or earlier
===========================================
Restore your sql dump created with pg_dumpall or by some other method using psql or some other method
===========================================
29110310

===========================================
Step 3
===========================================
Login to Web Host Manager and choose “Postgres Config” under Server Setup.

Set a postgres password to anything of your choosing. You should avoid using any non-alpha numeric charaters as these cause problems.
===========================================

===========================================
Step 4
===========================================
Use the “Postgres Config” option in WHM to install a postgres pg_hba.conf file. You can skip this step if you would like to setup your pg_hba.conf file manually. cPanel should work fine with md5 passwords or plaintext passwords
===========================================

The post Installing Postgresql appeared first on Hivelocity Hosting.

]]>
https://www.hivelocity.net/kb/installing-postgresql/feed/ 0