Learning Heroku Postgres
()
About this ebook
- Manage and optimize your PostgreSQL database with Heroku Postgres
- Secure your database with rollback, followers and forks functionalities
- A step-by-step tutorial with examples to help you get to grips with proficiency in Heroku Postgres database
Learning Heroku Postgres is targeted at developers and database admins. Even if you're new to Heroku Postgres, you'll be able to master both the basic as well as advanced features of Heroku Postgres. Since Heroku Postgres is incredibly user-friendly, no previous experience in computer coding or programming is required.
Related to Learning Heroku Postgres
Related ebooks
AngularJS Deployment Essentials Rating: 0 out of 5 stars0 ratingsBuilding Single-page Web Apps with Meteor Rating: 5 out of 5 stars5/5Instant Java Password and Authentication Security Rating: 0 out of 5 stars0 ratingsBuilding Slack Bots Rating: 0 out of 5 stars0 ratingsMastering Scala Machine Learning Rating: 0 out of 5 stars0 ratingsBackbone.js Patterns and Best Practices Rating: 0 out of 5 stars0 ratingsApache Solr PHP Integration Rating: 0 out of 5 stars0 ratingsGit Best Practices Guide Rating: 0 out of 5 stars0 ratingsPostgreSQL Development Essentials Rating: 5 out of 5 stars5/5Building a Web Application with PHP and MariaDB: A Reference Guide Rating: 0 out of 5 stars0 ratingsInstant Play Framework Starter Rating: 0 out of 5 stars0 ratingsRESTful Web API Design with Node.js - Second Edition Rating: 1 out of 5 stars1/5Mastering PHP Design Patterns Rating: 0 out of 5 stars0 ratingsNginx Essentials Rating: 0 out of 5 stars0 ratingsMastering Flask Rating: 0 out of 5 stars0 ratingsASP.NET Core 3 and React: Hands-On full stack web development using ASP.NET Core, React, and TypeScript 3 Rating: 0 out of 5 stars0 ratingsLearning Puppet for Windows Server Rating: 0 out of 5 stars0 ratingsPostgreSQL 11 Administration Cookbook: Over 175 recipes for database administrators to manage enterprise databases Rating: 0 out of 5 stars0 ratingsAdministrating Solr Rating: 0 out of 5 stars0 ratingsASP.NET Web API Security Essentials Rating: 0 out of 5 stars0 ratingsMonitoring Docker Rating: 0 out of 5 stars0 ratingsOpenCart Theme and Module Development Rating: 0 out of 5 stars0 ratingsASP.NET 3.5 CMS Development Rating: 0 out of 5 stars0 ratingsRestlet in Action: Developing RESTful web APIs in Java Rating: 0 out of 5 stars0 ratingsPostgreSQL 9 Administration Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsIntelliJ IDEA Essentials Rating: 0 out of 5 stars0 ratingsAngularJS Web Application Development Cookbook Rating: 0 out of 5 stars0 ratingsAngularJS Web Application Development Blueprints Rating: 0 out of 5 stars0 ratingsSharePoint 2010 Web Parts in Action Rating: 0 out of 5 stars0 ratingsScala for Data Science Rating: 0 out of 5 stars0 ratings
System Administration For You
Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 0 out of 5 stars0 ratingsCompTIA A+ Complete Review Guide: Core 1 Exam 220-1101 and Core 2 Exam 220-1102 Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Cybersecurity: The Beginner's Guide: A comprehensive guide to getting started in cybersecurity Rating: 5 out of 5 stars5/5Learn Windows PowerShell in a Month of Lunches Rating: 0 out of 5 stars0 ratingsMastering Windows PowerShell Scripting Rating: 4 out of 5 stars4/5Bash Command Line Pro Tips Rating: 5 out of 5 stars5/5Practical Data Analysis Rating: 4 out of 5 stars4/5Git Essentials Rating: 4 out of 5 stars4/5PowerShell: A Comprehensive Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Wordpress 2023 A Beginners Guide : Design Your Own Website With WordPress 2023 Rating: 0 out of 5 stars0 ratingsLearn PowerShell Scripting in a Month of Lunches Rating: 0 out of 5 stars0 ratingsBash for Fun: Bash Programming: Principles and Examples Rating: 0 out of 5 stars0 ratingsLinux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsLinux Bible Rating: 0 out of 5 stars0 ratingsArduino: A Quick-Start Beginner's Guide Rating: 4 out of 5 stars4/5The Complete Powershell Training for Beginners Rating: 0 out of 5 stars0 ratingsImprove your skills with Google Sheets: Professional training Rating: 0 out of 5 stars0 ratingsNmap: Network Exploration and Security Auditing Cookbook - Second Edition Rating: 0 out of 5 stars0 ratingsWorking with Linux – Quick Hacks for the Command Line Rating: 5 out of 5 stars5/5Investigating Internet Crimes: An Introduction to Solving Crimes in Cyberspace Rating: 0 out of 5 stars0 ratingsPractical Windows Forensics Rating: 0 out of 5 stars0 ratingsPowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5Networking for System Administrators: IT Mastery, #5 Rating: 5 out of 5 stars5/5Windows Command Prompt Rating: 0 out of 5 stars0 ratings
Reviews for Learning Heroku Postgres
0 ratings0 reviews
Book preview
Learning Heroku Postgres - Patrick Espake
Table of Contents
Learning Heroku Postgres
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Instant updates on new Packt books
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started with Heroku Postgres
How does Heroku work?
Heroku Dashboard and Heroku Toolbelt
Deploying your applications
Heroku architecture
HTTP routing
Dyno Manager
Config vars
Understanding the Dynos
Workers
Add-ons
Logplex
Heroku API
Postgres supported versions
Choosing the right Heroku Postgres plan
Shared features
Production-tier technical characterization
High availability
Self-test Questions
Summary
2. Heroku Toolbelt
Signing up
Installing the Heroku Toolbelt
Logging in to Heroku
Deploying an application
The sample application source code
The dependencies file
Deploying the sample application
Visiting the sample application
Self-test questions
Summary
3. Postgres Add-on
Local setup
Setting up PostgreSQL on Mac OS X
Setting up PostgreSQL on Windows
Setting up PostgreSQL on Linux
Creating a local database
Creating a new app
Via the Heroku dashboard
Via the Heroku client
Adding the add-on and creating the first database
Adding the Heroku Postgres add-on
Via the Heroku add-ons gallery
Via the Heroku client
Creating the first database
Heroku Postgres web interface
Using the Heroku client with Postgres
The pg:info command
The pg:psql command
The pg:push command
The pg:pull command
The pg:ps command
The pg:kill command
The pg:killall command
The pg:promote command
The pg:credentials command
The pg:reset command
Connecting with Java
JDBC
Spring/XML
Connecting with Ruby
Connecting with Python
Connecting with Django
Connecting with Node.js
Connection permissions
Multiple schemas
External connections
Connecting to databases from outside Heroku
Monitoring and logging
Removing the add-on
Self-test Questions
Summary
4. PG Backups
Plans
Installing the add-on
Via the Heroku client
Via the web interface
Changing the plan
Creating a backup
Listing backups
Via the Heroku client
Via the web interface
Downloading a backup
Deleting backups
Restoring from a backup
Importing databases
Importing in Heroku Postgres
Exporting databases
Downloading the backup
Restoring to local database
Removing the add-on
Via the Heroku client
Via the web interface
Self-test Questions
Summary
5. Dataclips
Creating dataclips
Sharing dataclips
Interacting with dataclips
Data refresh
Dataclips security
Limitations and additional settings
Self-test questions
Summary
6. Rollback, Followers, and Forks
Heroku Postgres rollback
Checking the rollback feature
Available period
Creating a rollback database
Promote a rollback database
Deprovisioning a rollback database
Heroku Postgres follower databases
Creating and managing follower databases
Unfollow the main database
Upgrade the database plan with follower
High availability with followers
Heroku Postgres forking databases
Forking your database
Forking databases with the fast option
View your fork databases
Deprovisioning a fork database
Self-test questions
Summary
7. Understanding Log Statements and Common Errors
Log statements
Common errors
LOG: long duration
LOG: unexpected EOF on client connection
PGError: permission denied for relation
PGError: operator does not exist
PGError: relation table-name
does not exist
PGError: column column-name
cannot...
PGError: SSL SYSCALL error: EOF detected
PGError: prepared statement a30
already exists
FATAL: too many connections for role
FATAL: could not receive data...
FATAL: role role-name
...
FATAL: terminating connection due to administrator command
FATAL: remaining connection slots are reserved for non-replication superuser connections
Temporary file: path file path
, size file size
Metrics logs
Self-test questions
Summary
8. Extensions, PostGIS, Full Text Search Dictionaries, Data Caching, and Tuning
Heroku Postgres extensions
Data types
Case-insensitive text – citext
Cube
HStore
Label tree – ltree
Product numbering – isn
Functions
Earth distance
Intarray
Fuzzy match – fuzzystrmatch
PGCrypto
Table functions and pivot tables – tablefunc
Trigram – pg_trgm
UUID generation
Statistics
Row locking – pgrowlocks
Tuple statistics – pgstattuple
Index types
Btree GiST – btree_gist
Languages
PLV8 – V8 Engine JavaScript Procedural Language
Full text search dictionaries
Dict int
Unaccent
Data caching
Setting up PostGIS
Provisioning
Database tuning
Database VACUUM
Determining the bloat factor
Manual vacuuming
Automatic vacuuming
Performance analysis
Self-test Questions
Summary
A. Keyword List
B. Self-test Answers
Chapter 1: Getting Started with Heroku Postgres
Chapter 2: Heroku Toolbelt
Chapter 3: Postgres Add-on
Chapter 4: PG Backups
Chapter 5: Dataclips
Chapter 6: Rollback, Followers, and Forks
Chapter 7: Understanding Log Statements and Common Errors
Chapter 8: Extensions, PostGIS, Full Text Search Dictionaries, Data Caching, and Tuning
Index
Learning Heroku Postgres
Learning Heroku Postgres
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2015
Production reference: 1190215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78217-345-8
www.packtpub.com
Credits
Author
Patrick Espake
Reviewers
Razvan Draghici
Andrea Mostosi
Peter Robinett
Karanraj Sankaranarayanan
Ariejan de Vroom
Commissioning Editor
Amarabha Bannerjee
Acquisition Editor
Nikhil Karkal
Content Development Editor
Pooja Nair
Technical Editor
Bharat Patil
Copy Editors
Karuna Narayanan
Laxmi Subramanian
Project Coordinator
Leena Purkait
Proofreaders
Stephen Copestake
Martin Diver
Paul Hindle
Indexer
Mariammal Chettiyar
Graphics
Disha Haria
Sheetal Aute
Production Coordinator
Alwin Roy
Cover Work
Alwin Roy
About the Author
Patrick Espake is passionate about technology, innovation, software development, and entrepreneurship. He has been professionally building and deploying web applications for over 10 years; with Heroku, it has been over 5 years, and he has worked on amazing projects for companies across the world. Currently, he is a cofounder of http://coursify.me. When Patrick isn't coding or writing, you will usually find him traveling to some wonderful place with his family.
I would like to thank my parents for their dedication and advice during my life, especially my mother, Elza, for not sparing effort and for her sacrifices to educate me and turn me into the person I am today. I would say that all your efforts were worthwhile and finishing this book together was a great achievement.
I also could never have finished this book without the support and encouraging words from my wife, Priscila. Through her infinite and pure love, she encouraged me and showed enormous patience during the several months that I've dedicated to this book. I would like to say that I am very grateful to be your husband.
I would also like to send a huge thank you to the Bard Kunenn family, who invited me numerous times for lunch during the weekends that I spent writing this book and provided me countless encouraging words for the creation of this book.
Finally, I would like to say thank you very much to my friend, Ana Carolina, for helping me in reviewing this book and for being so helpful with her suggestions for improvement.
About the Reviewers
Razvan Draghici is a full-stack software developer and scalability expert with over 7 years of experience in the field. In the past, he helped scale and develop high traffic applications for web properties, such as Sportsnet.ca, Bing Shopping Canada, and Canada Post Comparison Shopper. He is passionate about machine learning and data science, and while at Sportsnet he developed an NBA Playoffs winner prediction algorithm as part of a hackathon.
Razvan writes about software and technology at http://sleekd.com.
Andrea Mostosi is a technology enthusiast. An innovation lover since he was a child, he started his professional career in 2003 and worked on several projects, playing almost every role in the computer science environment. He is currently the CTO at The Fool, a company that tries to make sense of web and social data. During his free time, he likes to travel, run, cook, bike, and code.
I would like to thank my geek friends: Simone M, Daniele V, Luca T, Luigi P, Michele N, Luca O, Luca B, Diego C, and Fabio B. They are the smartest people I know and comparing myself with them has always pushed me to be better.
Peter Robinett is a backend and mobile developer, focusing on Scala and iOS development. He is a frequent user of the Heroku platform and is a fan of its power and extensibility.
He is currently a developer at Lua Technologies. He also works under the name Bubble Foundry and blogs occasionally at www.bubblefoundry.com.
Ariejan de Vroom is a software engineer from Son en Breugel, The Netherlands. He's been working professionally with Ruby on Rails at Kabisa since 2007. When not writing code, Ariejan likes to read, play the piano and experiment with electronics.
Karanraj Sankaranarayanan is a certified Salesforce.com developer and works as a Salesforce consultant at HCL Technologies. He holds a bachelor's degree in engineering from Anna University with specialization in computer science. He has more than