Projekt

Allgemein

Profil

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

[X] Daniel S, 11.05.2018 09:53

1 1 [X] Daniel S
h1. Datenbankeinstellungen und Tuning
2
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
15
@fsync = off@
16
@synchronous_commit = off@
17
@wal_buffers = -1@    (bis 9.3 8MB)
18
@checkpoint_segments = 64@ 
19
@max_wal_size = 3GB@     (ab 9.6 Ersatz für checkpoint_segments3 * checkpoint_segments) * 16MB )
20
21
@effective_cache_size = 2048MB@ (Beachte 1/2 Arbeitsspeicher)
22
23
@default_statistics_target = 1000@
24
25
@cursor_tuple_fraction = 0.75@ (siehe #6436)
26
27
@log_destination = 'eventlog'@ (unter Windows)
28
29
@search_path = '"$user",public,TSystem'@
30
31
@datestyle = 'iso, dmy'@
32
33
@standard_conforming_strings = off@ (siehe #4860)
34
35
@lc_messages@ > setzen wir hart von prodat aus auf englisch @'en_US.UTF-8' ('German_Germany.1252' )@ > das muß sein, da wir die Fehlermeldungen teilweise parsen und somit natürlich auf die fehler-strings gehen.
36
37 35 [X] Daniel S
@log_line_prefix@ > @'<%u@%d-%t> '@
38 1 [X] Daniel S
39
@lc_?@
40
41
42
43 34 [X] Daniel S
-Bis Prodat 11.5.3 @statement_timeout=120000@-
44
45
h2. Linux 
46
47
{{collapse(Linux)
48
49
h3. Betriebssystem - Speichereinstellungen mind. 3GiB Arbeitsspeicher!
50
51
* standard:
52
sysctl kernel.shmmax
53
kernel.shmmax = 33554432
54
55
* umsetzen auf 280437720 (256MB, Mindestens, LOLL steht auf 1024MB (8GB Ram)) (On Windows the useful range is 64MB to 512MB)
56
/etc/sysctl.conf  -> zeile aufnehmen: kernel.shmmax=280437720
57
reboot
58
59
h3. Nur auf Systemen mit 3GiB+ RAM anzuwenden
60
61
@$ free -m@
62
<pre>
63
             total       used       free     shared    buffers     cached
64
Mem:          3018       1516       1501          0        208       1113
65
-/+ buffers/cache:        194       2823
66
Swap:         1023          0       1023
67
</pre>
68
69
70
h3. Weiteres
71
72
Unter Linux ist noch die shmmax-Option aus der 99-postgresql.conf via sysctl zu setzen, sonst klappert das da.
73
http://www.postgresql.org/docs/8.2/static/kernel-resources.html
74
75
}}
76 1 [X] Daniel S
77 19 [S] Dominik G
78 14 [S] Dominik G
Könnte durchaus noch weiter getrieben werden, indem man Sie auf die Prodat-DB abstimmt:
79 13 [S] Dominik G
* http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
80 11 [X] Daniel S
* http://www.postgresql.org/docs/current/static/performance-tips.html
81 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
82
83 19 [S] Dominik G
84
*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.
85
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)
86 11 [X] Daniel S
87 12 [X] Daniel S
88 13 [S] Dominik G
h2. Virtualisierung
89 12 [X] Daniel S
90 13 [S] Dominik G
"Database_Virtualization_PG_China.pdf":http://www.prodat-sql.de/redmine/attachments/download/2568/Database_Virtualization_PG_China.pdf