Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
PostgreSQL 11 Administration Cookbook

You're reading from  PostgreSQL 11 Administration Cookbook

Product type Book
Published in May 2019
Publisher Packt
ISBN-13 9781789537581
Pages 600 pages
Edition 1st Edition
Languages
Concepts
Authors (3):
Simon Riggs Simon Riggs
Profile icon Simon Riggs
Gianni Ciolli Gianni Ciolli
Profile icon Gianni Ciolli
Sudheer Kumar Meesala Sudheer Kumar Meesala
Profile icon Sudheer Kumar Meesala
View More author details
Toc

Table of Contents (19) Chapters close

Title Page
Copyright and Credits
About Packt
Contributors
Preface
1. First Steps 2. Exploring the Database 3. Configuration 4. Server Control 5. Tables and Data 6. Security 7. Database Administration 8. Monitoring and Diagnosis 9. Regular Maintenance 10. Performance and Concurrency 11. Backup and Recovery 12. Replication and Upgrades 1. Other Books You May Enjoy Index

Finding slow SQL statements


There are two main kinds of slowness that can manifest themselves in a database.

The first kind is a single query that can be too slow to be really usable, such as a customer information query in a CRM running for minutes, a password check query running in tens of seconds, or a daily data aggregation query running for more than a day. These can be found by logging queries that take over a certain amount of time, either at the client end or in the database.

The second kind is a query that is run frequently (say a few thousand times a second) and used to run in single-digit milliseconds, but is now running in several tens or even hundreds of milliseconds, hence slowing the system down. This kind of slowness is much harder to find.

Here, we will show you several ways to find the statements that are either slow or cause the database as a whole to slow down (although they are not slow by themselves).

Getting ready

Connect to the database as the user whose statements you...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime