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