How to set up PostgreSQL for use with 1C:Enterprise Platform
Question: I want to use PostgreSQL as the database management system for my new 1C:Enterprise Platform setup. What do I need to do?
Answer: Let’s describe the process in 4 steps: 1C:Enterprise Platform installation, PostgreSQL installation, Post installation, Optimization/Troubleshooting.
1. 1C:Enterprise Platform installation:
Decide which platform version you need depending on the configuration (1C application) you want to use. For example the application we want to use is 1C:Drive version 1.5.1.6 which requires 1C:Enterprise Platform version 8.3.22.1750. So we download this platform version and proceed with installation.
Run the setup file, select required components as seen on the following screenshots.
Select interface language and click Next.
Install as service, tick. If USR1CV8 user does not already exist, have it created and assign your password.
Click Install:
After the installation of the platform is complete, installation of hardware copy protection (USD dongle) driver is offered. Most likely you will be using contemporary software copy protection rather then legacy USB dongle, so clear the ticks from those boxes as seen on the screenshot. Click Next.
Installation complete!
2. PostgreSQL installation:
Not all editions of PostgreSQL work with 1C:Enterprise Platform, or some editions may technically work but lack crucial “pgAdmin” functionality used for PostgreSQL administration. Moreover, version of the PostgreSQL must be compatible with the 1C:Enterprise Platform version to be used. Latest PostgreSQL version compatible with 1C:Enterprise Platform 8.3.22.1750 version is the PostgreSQL_12.7-5.1C version so we will download this version from "my1ci" and install.
Run the downloaded setup file as administrator.
Make sure “Install as a service” is selected. Click Next.
Make sure “Initialize database cluster” is selected. “Port number” you can keep as is. Enter any password you like, just do not forget it later. This is the password of the Postgres user.
“Locale” must be the same as the Locale of your infobase, otherwise you won’t be able create or use any infobases. When you first create a 1C:Enterprise Infobase from template, the “Locale” of the infobase is automatically selected from the Windows localization settings. When you first create a 1C:Enterprise infobase with empty configuration, you can choose the “Locale” of the infobase during it’s creation. Afterwards, you can change the “Locale” of the infobase via Designer, “Administration menu -> Regional infobase settings”.
Click Next.
Click Next.
When clicking Next, you may get this error:
Close the error dialog by clicking OK. Afterwards open Windows Task Manager, find “seclogon” (Secondary Logon) in Services tab, and you will see that the service has been stopped. Right-click it and “Start” the service.
It is recommended to set this service to be run automatically after each restart of the computer via “Open Services”.
When done, continue PostgreSQL installation from where we had left. Click Next. Installation is now complete. No need to run “Stack builder”, so clear the checkbox and click Finish.
From Windows start menu, run pgAdmin4. For the first run, the system may ask for a master password. Click on “Reset master password” and then enter your new master password and click OK. Please take note that master password is not the same as Postgres user password which you had designated during PostgreSQL installation.
Double-click the PostgresSQL Database Server 12.7-5.1C(x64), opens “Connect to server” dialog, input here your Postgres user password and click OK.
Now your Postgres setup is ready. You may see a message stating that you are using an older version of PostgreSQL, just close this message, no need to upgrade.
3. Post Installation:
Run “Administration of 1C Enterprise servers”, check if you see a “MMC could not create the snap-in” error.
If you see that error, close the “Administration of 1C Enterprise servers” and run “Register MSC console” as Administrator.
Success.
Open “Administration of 1C Enterprise servers” again. Now you should see that the console is registered.
Let’s create our first infobase now. From 1C:Enterprise startup, click Add to add a new infobase, then select “Create infobase”, infobase location type set as “1C:Enterprise server”. The following dialog will open. Fill our as seen on the screenshot below. Click Next.
If you have more than one 1C:Enterprise Platform version installed, you can designate explicitly which platform version you wish to use to open the infobase. Finish.
We got this error when attempted to create the infobase.
Click OK, go back two steps, take note that Language (country) was selected as English (United Sates), which does not match with what we had selected during PostgreSQL installation, hence the error. Correct this by choosing Turkish(Turkey) and proceed
The new infobase has been created!
4. Optimization/Troubleshooting:
From Task manager -> Services, Stop the “Postgresql” service.
Open “postgresql.conf” file in the data folder with a text editor such as Notepad++. Set the recommended values in this file:
max_connections = 100
fsync = on
wal_sync_method = open_datasync
effective_cache_size = 17GB
shared_buffers = 6GB
ssl = off
work_mem = 1536MB
temp_buffers = 1536MB
maintenance_work_mem = 2024MB
checkpoint_completion_target = 0.7
min_wal_size = 4GB
max_wal_size = 16GB
commit_delay = 1000
commit_siblings = 5
bgwriter_delay = 20ms
bgwriter_lru_multiplier = 4.0
bgwriter_lru_maxpages = 400
autovacuum = on
autovacuum_max_workers = 4
autovaccum_naptime = 20s
max_files_per_process = 8000
random_page_cost = 0.4
cpu_operator_cost = 0.00025
seq_page_cost = 0.1
from_collapse_limit = 20
join_collapse_limit = 6
geqo = on
geqo_threshold = 12
standard_conforming_strings = off
escape_string_warning = off
max_locks_per_transaction = 248
default_statistics_target = 300
row_security = off
Save the modified “postgresql.conf” file.
From Task manager -> Services, Start the Postgreqsl service.
About infobase “Locale”
When you click the information icon of a 1C:Enterprise Platform infobase either from Designer or from Enterprise mode, you are presented with the information window. In this window you can see the locale of the infobase under “Locale:”. On the other hand, “Session” shows the Windows localization setting. The “Locale” you had chosen when installing the PostgreSQL must be the same as the locale of the infobase.
When you are creating an 1C:Enterprise Platform infobase with empty configuration (that is, not from template), you can select the “Locale” of the infobase to be created from the new infobase creation window.
When you are creating an 1C:Enterprise Platform infobase from template, so in the end you receive an infobase with 1C:Drive configuration for example, the locale of the infobase is automatically assigned the same value as the Windows localization setting being used. Later on you can change the “Locale” of this infobase from the designer, “Administration menu -> Regional infobase settings”.