710 Datenbankeinstellungen und Tuning (postgresql conf) » Historie » Version 12
[X] Daniel S, 03.06.2013 13:35
1 | 1 | [X] Daniel S | h1. Datenbankeinstellungen und Tuning |
---|---|---|---|
2 | |||
3 | h2. Allgemeines |
||
4 | |||
5 | Bis Prodat 11.5.3 |
||
6 | statement_timeout=120000 |
||
7 | (danach keine Einstellung mehr vornehmen -> zurück auf 0) |
||
8 | |||
9 | fsync=off |
||
10 | date_style = DMY |
||
11 | log_destination (unter Windows -> eventlog) |
||
12 | |||
13 | h2. Linux - Betriebssystem - Speichereinstellungen, mind 3GB Arbeitsspeicher! |
||
14 | |||
15 | 4 | [X] Daniel S | ->standard: |
16 | 1 | [X] Daniel S | sysctl kernel.shmmax |
17 | kernel.shmmax = 33554432 |
||
18 | |||
19 | 8 | [X] Daniel S | -> umsetzen auf 280437720 (256MB, Mindestens, LOLL steht auf 1024MB (8GB Ram)) (On Windows the useful range is 64MB to 512MB) |
20 | 3 | [X] Daniel S | /etc/sysctl.conf -> zeile aufnehmen: kernel.shmmax=280437720 |
21 | 5 | [X] Daniel S | reboot |
22 | 1 | [X] Daniel S | |
23 | |||
24 | h2. Speichereinstellungen Postgres (Beachte Betriebssystem) |
||
25 | |||
26 | 9 | [S] Dominik G | * shared_buffers = 256MB (default 32MB, (siehe oben)) |
27 | * work_mem = 16MB (default 1MB) (nicht zu hoch, da je sort bzw. hash Operation, auch mehrfach bei komplexen queries) |
||
28 | * maintenance_work_mem = 64MB (default 16MB) bis 512MB (für VACUUM, CREATE INDEX, and ALTER TABLE ADD FOREIGN KEY, außerdem für restore dumps) |
||
29 | * effective_cache_size = 1280MB (default 128MB)-> Beachte 1/2 Arbeitsspeicher: |
||
30 | 8 | [X] Daniel S | > Setting effective_cache_size to 1/2 of total memory would be a normal conservative setting, and 3/4 of memory is a more aggressive but still reasonable amount. You might find a better estimate by looking at your operating system's statistics. On UNIX-like systems, add the free+cached numbers from free or top to get an estimate. On Windows see the "System Cache" size in the Windows Task Manager's Performance tab. Changing this setting does not require restarting the database (HUP is enough). |
31 | |||
32 | checkpoint_segments = 32 # in logfile segments, min 1, 16MB each |
||
33 | checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0 |
||
34 | 1 | [X] Daniel S | |
35 | |||
36 | -- |
||
37 | |||
38 | |||
39 | 1.) |
||
40 | Nur auf Systemen mit 3+GB RAM anzuwenden: |
||
41 | > $ free -m |
||
42 | > total used free shared buffers cached |
||
43 | > Mem: 3018 1516 1501 0 208 1113 |
||
44 | > -/+ buffers/cache: 194 2823 |
||
45 | > Swap: 1023 0 1023 |
||
46 | |||
47 | Unter Linux ist noch die shmmax-Option aus der 99-postgresql.conf via |
||
48 | sysctl zu setzen, sonst klappert das da. |
||
49 | > http://www.postgresql.org/docs/8.2/static/kernel-resources.html |
||
50 | |||
51 | 2.) |
||
52 | Könnten durchaus noch weiter getrieben werden, indem man Sie auf die |
||
53 | Prodat-DB abstimmt: |
||
54 | > http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server |
||
55 | > http://www.postgresql.org/docs/current/static/performance-tips.html |
||
56 | 10 | [X] Daniel S | |
57 | http://www.prodat-sql.de/redmine/attachments/download/2528/five_steps_perform_2009.pdf => Dokument über Einstellungen etc |
||
58 | 11 | [X] Daniel S | |
59 | |||
60 | <pre> |
||
61 | shared_buffers = 1024MB |
||
62 | temp_buffers = 8MB |
||
63 | work_mem = 16MB |
||
64 | maintenance_work_mem = 512MB |
||
65 | |||
66 | effective_cache_size = 2056MB |
||
67 | |||
68 | fsync = off # turns forced synchronization on or off |
||
69 | synchronous_commit = off # immediate fsync at commit |
||
70 | wal_buffers = 8MB |
||
71 | checkpoint_segments = 64 |
||
72 | |||
73 | default_statistics_target = 1000 |
||
74 | </pre> |
||
75 | 12 | [X] Daniel S | |
76 | h3. Virtualisierung |
||
77 | |||
78 | http://www.prodat-sql.de/redmine/attachments/download/2568/Database_Virtualization_PG_China.pdf |