Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
PostgreSQL 10 Administration Cookbook

You're reading from   PostgreSQL 10 Administration Cookbook Over 165 effective recipes for database management and maintenance in PostgreSQL 10

Arrow left icon
Product type Paperback
Published in May 2018
Publisher Packt
ISBN-13 9781788474924
Length 576 pages
Edition 4th Edition
Languages
Arrow right icon
Toc

Table of Contents (19) Chapters Close

Title Page
Copyright and Credits
Packt Upsell
Contributors
Preface
1. First Steps FREE CHAPTER 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 out what makes SQL slow


An SQL statement can be slow for a lot of reasons. Here, we will give a short list of these, with at least one way of recognizing each reason.

Getting ready

If the SQL statement is still running, look at Chapter 8, Monitoring and Diagnosis.

How to do it…

The core issues are likely to be one of these:

  • You're asking it to do too much work
  • Something is stopping it from doing the work

This might not sound that helpful at first, but it's good to know that there's nothing really magical going on that you can't understand if you look.

In more detail, the main reasons are:

  • Returning too much data
  • Processing too much data index needed
  • Wrong plan for other reasons
  • Cache or I/O problems
  • Locking problems

The first reason can be handled as described in the Reducing the number of rows returned recipe.Reasons 2-4can be investigated from two perspectives:TheSQLitselfand the objects that the SQL touches. Let's start by looking at the SQLitselfby running the query with EXPLAINANALYZE. We...

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
Visually different images