Projekt

Allgemein

Profil

710 Datenbankeinstellungen und Tuning (postgresql conf) » Historie » Version 49

[S] Philipp K, 31.07.2018 10:56

1 42 [X] Daniel S
h1. postgresql.conf: Datenbankeinstellungen und Tuning
2 1 [X] Daniel S
3 26 [S] Philipp K
4 23 [E] Oleg G
@postgresql.conf@ ([[PostgreSQL Netzwerkkonfiguration (pg_hba.conf)]])
5 1 [X] Daniel S
6 25 [E] Oleg G
Datei-Pfad: *H:\PostgreSQL\9.6\data\pg96\postgresql.conf*
7
8 1 [X] Daniel S
h2. Konfiguration PostgreSQL (Beachte Betriebssystem) ab Version 9.3 
9 26 [S] Philipp K
10 1 [X] Daniel S
@shared_buffers = 1024MB@
11
@temp_buffers = 8MB@
12
@work_mem = 16MB@ (nicht zu hoch, da je sort bzw. hash Operation, auch mehrfach bei komplexen queries)
13
@maintenance_work_mem = 512MB@ (für VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY, außerdem für restore dumps)
14 49 [S] Philipp K
@dynamic_shared_memory_type = windows@
15 1 [X] Daniel S
16 49 [S] Philipp K
@max_worker_processes = 8@ > Default ist 8 (keine Änderung nötig). Je nach Unternehmensgröße mehr
17
@max_parallel_workers_per_gather = 4@
18 1 [X] Daniel S
19
20 49 [S] Philipp K
@fsync = off@
21
@synchronous_commit = off@
22 45 [X] Richard H
@wal_compression = on@
23 44 [X] Richard H
@wal_buffers = -1@    (bis 9.3 8MB)
24 1 [X] Daniel S
@max_wal_size = 3GB@     (ab 9.6 Ersatz für checkpoint_segments3 * checkpoint_segments) * 16MB )
25
26
@effective_cache_size = 2048MB@ (Beachte 1/2 Arbeitsspeicher)
27
28 41 [X] Daniel S
@default_statistics_target = 1000@
29 38 [X] Daniel S
30
@cursor_tuple_fraction = 0.75@ (siehe #6436)
31 47 [S] Philipp K
32
33 1 [X] Daniel S
@log_destination = 'eventlog'@ (unter Windows)
34
35 46 [E] Oleg G
@search_path = '"$user",public,TSystem,prodat_languages,Z_99_Deprecated'@
36 1 [X] Daniel S
37
@datestyle = 'iso, dmy'@
38
39
@standard_conforming_strings = off@ (siehe #4860)
40
41
@lc_messages = 'en_US.UTF-8'@ > das muß sein, da wir die Fehlermeldungen teilweise parsen und somit natürlich auf die fehler-strings gehen.
42
43
@log_line_prefix = '<%u@@@%d-%t> '@
44
45
@lc_?@
46 40 [X] Daniel S
47 49 [S] Philipp K
{{collapse(Alte Versionen:)
48
<pre><code class="sql">
49
@# checkpoint_segments = 64 # in 9.6 nicht supported@
50
</code></pre>
51
}}
52 1 [X] Daniel S
53
54 34 [X] Daniel S
-Bis Prodat 11.5.3 @statement_timeout=120000@-
55
56
h2. Linux 
57
58
{{collapse(Linux)
59
60
h3. Betriebssystem - Speichereinstellungen mind. 3GiB Arbeitsspeicher!
61
62
* standard:
63
sysctl kernel.shmmax
64
kernel.shmmax = 33554432
65
66
* umsetzen auf 280437720 (256MB, Mindestens, LOLL steht auf 1024MB (8GB Ram)) (On Windows the useful range is 64MB to 512MB)
67
/etc/sysctl.conf  -> zeile aufnehmen: kernel.shmmax=280437720
68
reboot
69
70
h3. Nur auf Systemen mit 3GiB+ RAM anzuwenden
71
72
@$ free -m@
73
<pre>
74
             total       used       free     shared    buffers     cached
75
Mem:          3018       1516       1501          0        208       1113
76
-/+ buffers/cache:        194       2823
77
Swap:         1023          0       1023
78
</pre>
79
80
81
h3. Weiteres
82
83
Unter Linux ist noch die shmmax-Option aus der 99-postgresql.conf via sysctl zu setzen, sonst klappert das da.
84
http://www.postgresql.org/docs/8.2/static/kernel-resources.html
85
86
}}
87 1 [X] Daniel S
88 19 [S] Dominik G
89 14 [S] Dominik G
Könnte durchaus noch weiter getrieben werden, indem man Sie auf die Prodat-DB abstimmt:
90 13 [S] Dominik G
* http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
91 11 [X] Daniel S
* http://www.postgresql.org/docs/current/static/performance-tips.html
92 13 [S] Dominik G
* "five_steps_perform_2009.pdf":http://www.prodat-sql.de/redmine/attachments/download/2528/five_steps_perform_2009.pdf Dokument über Einstellungen etc
93
94 19 [S] Dominik G
95
*Hinweis:* Fehler im PgAdmin/Server-Status: ungültige Byte-Sequenz für Kodierung "UTF8" ... durch SELECT pg_file_read('pg_log/... kann ignoriert werden, da wir ja ins eventlog schreiben.
96
Die Anzeige vom Log hier einfach schließen. Liegt an LC_MESSAGES und mehrsprachigen Systemen, vermutlich ein Bug, Workaround LC_MESSAGES='C' (evtl. nicht mit Prodat kompatibel)
97 11 [X] Daniel S
98 12 [X] Daniel S
99 13 [S] Dominik G
h2. Virtualisierung
100 12 [X] Daniel S
101 13 [S] Dominik G
"Database_Virtualization_PG_China.pdf":http://www.prodat-sql.de/redmine/attachments/download/2568/Database_Virtualization_PG_China.pdf