Projekt

Allgemein

Profil

710 Datenbankeinstellungen und Tuning (postgresql conf) » Historie » Revision 11

Revision 10 ([X] Daniel S, 22.05.2013 19:15) → Revision 11/85 ([X] Daniel S, 22.05.2013 20:02)

h1. Datenbankeinstellungen und Tuning 

 h2. Allgemeines 

 Bis Prodat 11.5.3 
 statement_timeout=120000 
 (danach keine Einstellung mehr vornehmen -> zurück auf 0) 

 fsync=off 
 date_style = DMY 
 log_destination (unter Windows -> eventlog) 

 h2. Linux - Betriebssystem - Speichereinstellungen, mind 3GB Arbeitsspeicher! 

 ->standard: 
 sysctl kernel.shmmax 
 kernel.shmmax = 33554432 

 -> umsetzen auf 280437720 (256MB, Mindestens, LOLL steht auf 1024MB (8GB Ram)) (On Windows the useful range is 64MB to 512MB) 
 /etc/sysctl.conf    -> zeile aufnehmen: kernel.shmmax=280437720 
 reboot 


 h2. Speichereinstellungen Postgres (Beachte Betriebssystem) 

 * shared_buffers = 256MB (default 32MB, (siehe oben)) 
 * work_mem         = 16MB    (default 1MB) (nicht zu hoch, da je sort bzw. hash Operation, auch mehrfach bei komplexen queries) 
 * 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) 
 * effective_cache_size = 1280MB (default 128MB)-> Beachte 1/2 Arbeitsspeicher: 
 > 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).  

 checkpoint_segments = 32 		 # in logfile segments, min 1, 16MB each 
 checkpoint_completion_target = 0.9 	 # checkpoint target duration, 0.0 - 1.0 


 -- 


 1.) 
 Nur auf Systemen mit 3+GB RAM anzuwenden: 
 > $ free -m 
 >                total         used         free       shared      buffers       cached 
 > Mem:            3018         1516         1501            0          208         1113 
 > -/+ buffers/cache:          194         2823 
 > Swap:           1023            0         1023 

 Unter Linux ist noch die shmmax-Option aus der 99-postgresql.conf via 
 sysctl zu setzen, sonst klappert das da. 
 > http://www.postgresql.org/docs/8.2/static/kernel-resources.html 

 2.) 
 Könnten durchaus noch weiter getrieben werden, indem man Sie auf die 
 Prodat-DB abstimmt: 
 > http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server 
 > http://www.postgresql.org/docs/current/static/performance-tips.html 

 http://www.prodat-sql.de/redmine/attachments/download/2528/five_steps_perform_2009.pdf => Dokument über Einstellungen etc 


 <pre> 
 shared_buffers = 1024MB 
 temp_buffers = 8MB 
 work_mem = 16MB 
 maintenance_work_mem = 512MB 

 effective_cache_size = 2056MB 

 fsync = off 				 # turns forced synchronization on or off 
 synchronous_commit = off 		 # immediate fsync at commit 
 wal_buffers = 8MB 
 checkpoint_segments = 64 

 default_statistics_target = 1000 
 </pre>