710 Datenbankeinstellungen und Tuning (postgresql conf) » Historie » Version 20
[S] Dominik G, 17.09.2015 13:10
| 1 | 1 | [X] Daniel S | h1. Datenbankeinstellungen und Tuning |
|---|---|---|---|
| 2 | |||
| 3 | 13 | [S] Dominik G | @postgresql.conf@ |
| 4 | 1 | [X] Daniel S | |
| 5 | 13 | [S] Dominik G | h2. Linux |
| 6 | 1 | [X] Daniel S | |
| 7 | 19 | [S] Dominik G | h3. Betriebssystem - Speichereinstellungen mind. 3GiB Arbeitsspeicher! |
| 8 | 1 | [X] Daniel S | |
| 9 | 13 | [S] Dominik G | * standard: |
| 10 | 1 | [X] Daniel S | sysctl kernel.shmmax |
| 11 | kernel.shmmax = 33554432 |
||
| 12 | |||
| 13 | 13 | [S] Dominik G | * umsetzen auf 280437720 (256MB, Mindestens, LOLL steht auf 1024MB (8GB Ram)) (On Windows the useful range is 64MB to 512MB) |
| 14 | 4 | [X] Daniel S | /etc/sysctl.conf -> zeile aufnehmen: kernel.shmmax=280437720 |
| 15 | 1 | [X] Daniel S | reboot |
| 16 | |||
| 17 | |||
| 18 | 19 | [S] Dominik G | h3. Nur auf Systemen mit 3GiB+ RAM anzuwenden |
| 19 | |||
| 20 | 13 | [S] Dominik G | @$ free -m@ |
| 21 | <pre> |
||
| 22 | total used free shared buffers cached |
||
| 23 | Mem: 3018 1516 1501 0 208 1113 |
||
| 24 | -/+ buffers/cache: 194 2823 |
||
| 25 | Swap: 1023 0 1023 |
||
| 26 | 1 | [X] Daniel S | </pre> |
| 27 | |||
| 28 | |||
| 29 | 19 | [S] Dominik G | h3. Weiteres |
| 30 | |||
| 31 | 13 | [S] Dominik G | Unter Linux ist noch die shmmax-Option aus der 99-postgresql.conf via sysctl zu setzen, sonst klappert das da. |
| 32 | 1 | [X] Daniel S | http://www.postgresql.org/docs/8.2/static/kernel-resources.html |
| 33 | |||
| 34 | |||
| 35 | 13 | [S] Dominik G | h2. Konfiguration PostgreSQL (Beachte Betriebssystem) |
| 36 | 1 | [X] Daniel S | |
| 37 | 13 | [S] Dominik G | @shared_buffers = 1024MB@ |
| 38 | @temp_buffers = 8MB@ |
||
| 39 | 1 | [X] Daniel S | @work_mem = 16MB@ (nicht zu hoch, da je sort bzw. hash Operation, auch mehrfach bei komplexen queries) |
| 40 | 18 | [S] Dominik G | @maintenance_work_mem = 512MB@ (für VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY, außerdem für restore dumps) |
| 41 | 1 | [X] Daniel S | |
| 42 | @fsync = off@ |
||
| 43 | 10 | [X] Daniel S | @synchronous_commit = off@ |
| 44 | 1 | [X] Daniel S | @wal_buffers = 8MB@ (@-1@ ab 9.3 "-1 sets based on shared_buffers") |
| 45 | @checkpoint_segments = 64@ |
||
| 46 | 18 | [S] Dominik G | |
| 47 | 19 | [S] Dominik G | @effective_cache_size = 2048MB@ (Beachte 1/2 Arbeitsspeicher) |
| 48 | |||
| 49 | 1 | [X] Daniel S | @default_statistics_target = 1000@ |
| 50 | |||
| 51 | 20 | [S] Dominik G | @cursor_tuple_fraction = 0.75@ (siehe #6436) |
| 52 | 19 | [S] Dominik G | |
| 53 | 16 | [S] Dominik G | @log_destination = 'eventlog'@ (unter Windows) |
| 54 | 13 | [S] Dominik G | |
| 55 | 1 | [X] Daniel S | @search_path = '"$user",public,TSystem'@ |
| 56 | 11 | [X] Daniel S | |
| 57 | 19 | [S] Dominik G | @datestyle = 'iso, dmy'@ |
| 58 | 15 | [S] Dominik G | |
| 59 | 19 | [S] Dominik G | @standard_conforming_strings = off@ (siehe #4860) |
| 60 | 15 | [S] Dominik G | |
| 61 | 19 | [S] Dominik G | |
| 62 | 1 | [X] Daniel S | Bis Prodat 11.5.3 @statement_timeout=120000@ |
| 63 | |||
| 64 | 19 | [S] Dominik G | |
| 65 | 14 | [S] Dominik G | Könnte durchaus noch weiter getrieben werden, indem man Sie auf die Prodat-DB abstimmt: |
| 66 | 13 | [S] Dominik G | * http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server |
| 67 | 11 | [X] Daniel S | * http://www.postgresql.org/docs/current/static/performance-tips.html |
| 68 | 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 |
| 69 | |||
| 70 | 19 | [S] Dominik G | |
| 71 | *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. |
||
| 72 | 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) |
||
| 73 | 11 | [X] Daniel S | |
| 74 | 12 | [X] Daniel S | |
| 75 | 13 | [S] Dominik G | h2. Virtualisierung |
| 76 | 12 | [X] Daniel S | |
| 77 | 13 | [S] Dominik G | "Database_Virtualization_PG_China.pdf":http://www.prodat-sql.de/redmine/attachments/download/2568/Database_Virtualization_PG_China.pdf |