Upload
raviwriter
View
39
Download
2
Embed Size (px)
Citation preview
i. Understand your application workloadii. Choose the right hardwareiii. Select proper file systemiv. Benchmark your environmentv. Tune your Postgres Server vi. Perform Log Auditingvii. Understand your query planviii. Tune your queriesix. Implement proper indexingx. Run / Schedule Maintenance jobs
Top 10 Tips for Database Optimization
TIP 1Understand Your Application Workload
How your application is interacting with your database.
Is your application read intensive or write intensive
ETL jobs.
Reporting and Analytical queries
CPUWhich Processor Family?More Cores Vs Faster Cores.
RAMIt depends on Size of working data set.
I/ODisk and Disk bandwidth.
NetworkLag time / Bandwidth
TIP 2Choose the Right Hardware
What is your storage stagey?
SATA VS SCSI
DAS VS SAN
RAID POLICY
RAID CONTROLLER SETTINGS
Monitor o/p of iostat
Distribute DB objects across Tablespaces
Maintain Separate Disk for pg_xlog
Storage
TIP 4Benchmark Your Environment
CPU: PassMark, Sysbench
RAM: memtest, cachebench
I/O: bonnie++, dd
Network: bwping, netperf
DB: pgBench, Sysbench
Hardware and Database Tests:
max_connections shared_buffers Effective_cache_size Work_mem Maintenance_work_mem
TIP 5Tune Your PostgreSQL Server
Experiment with Best Values
TIP 6Perform Log AuditingEnable slow running queries in PostgreSQL :
Log_min_duration_statement
Pg_stat_statements
Pgbadger,EPOA
Auto-explain
TIP 9Implement Proper Indexing
Indexes
Partial Indexes
Expression Indexes
Unique Indexes
Multi-column Indexes
Managing / Maintaining Indexes
Unused Indexes and Index bloat