PostgreSQL database system for all types of databases (configuration, log, archive) is fully supported in D2000 System from version V10.0.38. In the previous version V10.0.37, PostgreSQL can be used only for archive databases.
To use PostgreSQL, it must be installed on the target computer. Installation can be done in two ways either manually or through the D2000 System installer, which fully installs all of the necessary components of PostgreSQL.
Note: we recommend installing PostgreSQL manually. For the selected version of PostgreSQL (e.g. 12), download and install the latest patch (e.g. 12.10). Then download and install the latest ODBC driver patch for the selected version (e.g. for version 12 it is at the time of writing this documentation psqlodbc_12_02_0000.zip). In the end, run the D2000 installer and install the D2000.
Caution - using a lower version PostgreSQL ODBC driver (e.g. 11) with a newer version of a PostgreSQL database (e.g. 12) can cause various problems and malfunctions!
Installation by the D2000 System installer is more user-friendly. It ensures installing of all necessary components for full integration with D2000 System. This method is mainly recommended for users who do not have any experience with PostgreSQL.
To install PostgreSQL, the user must check the Install the PostgreSQL in D2000 System Configuration Guide in this dialog window:
In some situations, this checkbox could be disabled, which means that the installer detected PostgreSQL on the computer and no other installation is necessary. The installer does not allow the installation of another PostgreSQL instance.
If PostgreSQL installation is enabled, the installer of PostgreSQL is started along with the configurator of the D2000 System. It requires setting some important parameters concerning PostgreSQL and configuring appropriate database service (see the section PostgreSQL structure). PostgreSQL installer guides the user through the dialog windows which enables to set some necessary parameters. Most of the windows contain the default value which is recommended for standard purposes.
User can install PostgreSQL also separately. For proper integration with D2000, it is necessary to install even another components according to these steps:
After installation (manual or automatic), PostgreSQL is configured and may be used in D2000 System.
D2000 System requires for its operation on PostgreSQL these programs configured correctly:
When PostgreSQL is installed through D2000 System installer, all necessary components are installed automatically.
After installation, the target computer contains the files of PostgreSQL in selected directory. For example, the utility psql.exe is placed in subdirectory bin. It allows to work with database on command line.
When installing, default PostgreSQL service with name postgresql-XXX-VV is created (where XXX defines the architecture x86/x64 and VV defines the version of database system, e.g. 9.3). This service is the main part of PostgreSQL. You may work (create databases, connect to database,...) with the database system unless this service is running.
After starting the service, PostgreSQL begin to listen on the configured network connection, the port of which was entered when installing. This interface can be changed in the configuration file of database service.
Each service has own directory (the path was defined when installing), which contains its configuration and data files.
The most important configuration files of database service are:
Most of the changes in the configuration files requires reloading of configuration by the database service. It can be done in two ways:
pg_ctl reload
SELECT pg_reload_conf();
Both these commands should not interrupt any currently executed operation or connection to the database service.
On the target computer, more than one database service can run which will listen on independent network interface / port and will contain own directory with configuration. The manual configuration of other service requires special knowledge about PostgreSQL. In D2000 System, new service can be simply created through the configuration tool D2000 Management Console.
Several independent databases can operate under one database service. Each database is identified by a unique name. Considering this fact, it is sufficient that one (default) database service runs on one computer. This service should cover several different databases. Partition of databases on several database services on one computer brings improvement of performance only in some specific situations.
In PostgreSQL, data are stored on disk to one data directory of database, which contains many data files. When creating the new database in a standard way, data directory is stored in the subdirectory of given database service. It means, when creating the new database, the new subdirectory will be created in the directory structure of its service. All data will be stored here.
In some situations, data storage into the directory structure of service is not desired. For example, if it is necessary to divide data directories of databases to separate directories. This problem can be solved by using so-called tablespaces. The tablespace represents some directory that is saved on physical disc and is defined for all database service. Tablespace can contain all database or only some entities such as tables, indexes,... In such case, data files that represent given entity (table, index,...) are stored into subdirectory of tablespace but not into directory of database service. When creating the database, user may select default tablespace. The entities can be moved between tablespaces but this feature is not described in this instruction.
The features of tablespace are also used by D2000 System, which stores data files of its databases to the application directory.
To manage PostgreSQL databases, user may use either utility psql.exe (it is placed in bin subdirectory of installation directory), which enables to browse and manage the system by command line, or graphic tool pgAdmin III, which is installed together with the database system.