Book Image

PostgreSQL High Performance Cookbook

By : Chitij Chauhan, Dinesh Kumar
Book Image

PostgreSQL High Performance Cookbook

By: Chitij Chauhan, Dinesh Kumar

Overview of this book

PostgreSQL is one of the most powerful and easy to use database management systems. It has strong support from the community and is being actively developed with a new release every year. PostgreSQL supports the most advanced features included in SQL standards. It also provides NoSQL capabilities and very rich data types and extensions. All of this makes PostgreSQL a very attractive solution in software systems. If you run a database, you want it to perform well and you want to be able to secure it. As the world’s most advanced open source database, PostgreSQL has unique built-in ways to achieve these goals. This book will show you a multitude of ways to enhance your database’s performance and give you insights into measuring and optimizing a PostgreSQL database to achieve better performance. This book is your one-stop guide to elevate your PostgreSQL knowledge to the next level. First, you’ll get familiarized with essential developer/administrator concepts such as load balancing, connection pooling, and distributing connections to multiple nodes. Next, you will explore memory optimization techniques before exploring the security controls offered by PostgreSQL. Then, you will move on to the essential database/server monitoring and replication strategies with PostgreSQL. Finally, you will learn about query processing algorithms.
Table of Contents (19 chapters)
PostgreSQL High Performance Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Monitoring CPU usage


In this recipe, we are going to use the sar command to monitor CPU usage on the system.

Getting ready

The commands used in this recipe have been performed on a Sun Solaris machine. Hence the command output may vary in different Unix and Linux-related systems.

How to do it...

We can use the sar command with the -u switch to monitor CPU utilization:

bash-3.2$ sar -u 10 8 
SunOS usstlz-pinfsi09 5.10 Generic_150400-04 sun4u    08/06/2014 
 
23:32:17    %usr    %sys    %wio   %idle 
23:32:27      80      14       3      3 
23:32:37      70      14      12      4 
23:32:47      72      13      21      4 
23:32:57      76      14       6      3 
23:33:07      73      10      13      4 
23:33:17      71       8      17      4 
23:33:27      67       9      20      4 
23:33:37      69      10      17      4 
 
Average       73      11      13      4 

In the preceding command with the -u switch, two values are...