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