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
Explore 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
Learning PostgreSQL
Learning PostgreSQL

Learning PostgreSQL: Create, develop and manage relational databases in real world applications using PostgreSQL

Arrow left icon
Profile Icon Juba Profile Icon Achim Vannahme Profile Icon Volkov
Arrow right icon
€8.99 €36.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (5 Ratings)
eBook Nov 2015 464 pages 1st Edition
eBook
€8.99 €36.99
Paperback
€45.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Juba Profile Icon Achim Vannahme Profile Icon Volkov
Arrow right icon
€8.99 €36.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2 (5 Ratings)
eBook Nov 2015 464 pages 1st Edition
eBook
€8.99 €36.99
Paperback
€45.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €36.99
Paperback
€45.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learning PostgreSQL

Chapter 2. PostgreSQL in Action

PostgreSQL (pronounced Post-Gres-Q-L) or postgres is an open source object relational database management system. It emphasizes extensibility, creativity, as well as compatibility. It competes with the major relational database vendors such as Oracle, MySQL, SQL servers, and others. It is used by different sectors including government agencies and the public and private sectors. It is a cross-platform DBMS, and runs on most modern operating systems including Windows, MAC, and Linux flavors. It conforms to SQL, and is ACID compliant.

An overview of PostgreSQL

PostgreSQL (http://www.postgresql.org/) has many rich features. It provides enterprise level services including performance, unique features, and scalability. It has a very supportive community and very good documentation.

PostgreSQL history

The name PostgreSQL is derived from post-ingres database. PostgreSQL history could be summarized as follows:

  • Academia: University of California at Berkeley (UCB)
    • 1977-1985, the Ingres project: Michael Stonebraker created an RDBMS based on the formal relational model.
    • 1986-1994, postgres: Michael Stonebraker created postgres in order to support complex data types and the object relational model.
    • 1995, Postgres95: Andrew Yu and Jolly Chen changed the postgres POSTQUEL query language with an extended subset of SQL
  • Industry
    • 1996, PostgreSQL: Several developers dedicated a lot of labor and time to stabilize postgres95. The first open source version was released on January 29, 1997. With the introduction of new features, enhancements, and...

PostgreSQL capabilities

PostgreSQL provides enterprise-level services which guarantee the continuation of the business.

Replication

Replication allows data from one database server to be replicated to another server. Replication is used mainly to achieve the following:

  • High availability: A second server can take over if the primary server fails.
  • Load balancing: Several servers can serve the same requests.
  • Faster execution: A query is executed on several machines at once to gain performance.

PostgreSQL supports replication out of the box via streaming replication. Streaming replication is a master-slave replication that uses file-based log shipping. Streaming replication is a binary replication technique, because SQL statements are not analyzed. It is based on taking a snapshot of the master node, and then shipping the changes—the WAL files—from the master node to the slave node and replaying them on the slave. The master can be used for read/write operations, and the slave can be...

Installing PostgreSQL

PostgreSQL can be installed on almost all modern operating systems. It can be installed on all recent Linux distributions, Windows 2000 SP4 and later, FreeBSD, OpenBSD, Mac OS X, AIX, and Solaris. Also, PostgreSQL can work on various CPU architectures including x86, x86_64, IA64, and others. One can check if a platform (operating system and CPU architecture combination) is supported by exploring the PostgreSQL Build farm (http://buildfarm.postgresql.org/).

One can compile and install PostgreSQL from the source code or download its binary and install it.

Tip

In order to automate PostgreSQL installation and to reduce server administrative tasks, it is recommended to use PostgreSQL binaries, which come with the operating system packaging system. This approach normally has one drawback: not up-to-date binaries.

Installing PostgreSQL on Ubuntu

Ubuntu is a Debian-based widely spread Linux operating system. Ubuntu uses the Advanced Packaging Tool (APT), which handles software...

Summary

PostgreSQL is an open source, object-oriented relational database system. It supports many advanced features and complies with the ANSI-SQL:2008 standard. It has won industry recognition and user appreciation. The PostgreSQL slogan "The world's most advanced open source database" reflects the sophistication of the PostgreSQL features. It is a result of many years of research and collaboration between academia and industry. Startup companies often favor PostgreSQL due to low licensing costs. PostgreSQL can aid profitable business models. PostgreSQL is also favored by many developers because of its capabilities and advantages.

PostgreSQL can be used for OLTP and OLAP applications. It is ACID compliant; thus, it can be used out of the box for OLTP applications. For OLAP applications, PostgreSQL supports the Windows functions, FDW, and table inheritance. Also, there are many external extensions for this purpose.

Several proprietary DBMSs are based on PostgreSQL. In addition...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn about the PostgreSQL development life cycle including its testing and refactoring
  • Build productive database solutions and use them in Java applications
  • A comprehensive guide to learn about SQL, PostgreSQL procedural language and PL/pgSQL

Description

PostgreSQL is one of the most powerful and easy to use database management systems. It supports the most advanced features included in SQL standards. The book starts with the introduction of relational databases with PostegreSQL. It then moves on to covering data definition language (DDL) with emphasis on PostgreSQL and common DDL commands supported by ANSI SQL. You will then learn the data manipulation language (DML), and advanced topics like locking and multi version concurrency control (MVCC). This will give you a very robust background to tune and troubleshoot your application. The book then covers the implementation of data models in the database such as creating tables, setting up integrity constraints, building indexes, defining views and other schema objects. Next, it will give you an overview about the NoSQL capabilities of PostgreSQL along with Hstore, XML, Json and arrays. Finally by the end of the book, you'll learn to use the JDBC driver and manipulate data objects in the Hibernate framework.

Who is this book for?

If you are a student, database developer or an administrator, interested in developing and maintaining a PostgreSQL database, then this book is for you. No knowledge of database programming or administration is necessary.

What you will learn

  • Learn concepts of data modelling and relation algebra
  • Install and set up PostgreSQL database server and client software
  • Implement data structures in PostgreSQL
  • Manipulate data in the database using SQL
  • Implement data processing logic in the database with stored functions, triggers and views
  • Test database solutions and assess the performance
  • Integrate database with Java applications
  • Detailed knowledge of the main PostgreSQL building objects, most used extensions
  • Practice database development life cycle including analysis, modelling, (documentation), testing, bug fixes and refactoring

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 30, 2015
Length: 464 pages
Edition : 1st
Language : English
ISBN-13 : 9781783989195
Category :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 30, 2015
Length: 464 pages
Edition : 1st
Language : English
ISBN-13 : 9781783989195
Category :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 107.97
Troubleshooting PostgreSQL
€24.99
PostgreSQL Replication, Second Edition
€36.99
Learning PostgreSQL
€45.99
Total 107.97 Stars icon
Banner background image

Table of Contents

15 Chapters
1. Relational Databases Chevron down icon Chevron up icon
2. PostgreSQL in Action Chevron down icon Chevron up icon
3. PostgreSQL Basic Building Blocks Chevron down icon Chevron up icon
4. PostgreSQL Advanced Building Blocks Chevron down icon Chevron up icon
5. SQL Language Chevron down icon Chevron up icon
6. Advanced Query Writing Chevron down icon Chevron up icon
7. Server-Side Programming with PL/pgSQL Chevron down icon Chevron up icon
8. PostgreSQL Security Chevron down icon Chevron up icon
9. The PostgreSQL System Catalog and System Administration Functions Chevron down icon Chevron up icon
10. Optimizing Database Performance Chevron down icon Chevron up icon
11. Beyond Conventional Data types Chevron down icon Chevron up icon
12. Testing Chevron down icon Chevron up icon
13. PostgreSQL JDBC Chevron down icon Chevron up icon
14. PostgreSQL and Hibernate Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(5 Ratings)
5 star 60%
4 star 20%
3 star 0%
2 star 20%
1 star 0%
Zoltan Dec 31, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book starts out with a nice and conveniently brief but concise summary of all the main terms and concepts of database theory, including NoSQL and (object)relational databases. One does well to read up on the former (NoSQL) concept on the web since there are more than 225 of them as of today (nosql-database.org), whereas the book will focus on the SQL concepts afterwards. I really liked the fact that the authors do not shy away from explaining even the most basic terms in significant detail; this way absolute beginners will also fully benefit from the book, whereas more experienced programmers and administrators can simply just skim through these parts for a quick refresher. As an example, the often problematic concept of "unknown" (NULL) values and their relationship with TRUE and FALSE values is very nicely handled, including the truth tables for OR, AND and NOT.The basic concepts are also put into context via a well-detailed example application of a car web-portal, including detailed flow- and relationship charts (ER diagrams), which will help even the very beginners to understand the way of thinking required in database design. All code is available from the publisher, which saves the programmer a lot of typing time and typos.The detailed description of PostgreSQL is very complete, with history, concepts and sample applications. I would add to their "Success stories" the very popular and well established image database application OMERO (http://www.openmicroscopy.org/site), which has been around for 10 years and is being used by hundreds of research labs and institutions around the world, as well as by scientific journals. I personally installed OMERO, and thus PostgreSQL, many times and always found installing PostgreSQL very straightforward. The book will also guide the readers through these steps, including server settings, adding users, administration, etc. The setting up of clients is described in great detail, rightly so since this is the key concept for main users of databases once the installation is done.The book does a great job in explaining all the details of setting up the database, editing and acquiring its data, at the same time pointing out the most typical mistakes that users and administrators will encounter. Special emphasis is given to the various data types in relation not only to fitting the task at hand, but also to maintain and adjust the database to future demands. E.g., the great flexibility of the "text" type is given properly detailed description in Chapter 3. Using the same database example of the car web-portal throughout the book helps the reader to relate all new theoretical information easily to practicality.The later chapters (from Chapter 4) deal with more advanced concepts. These are crucial for those developing more demanding database applications and thus are very useful for the more experienced developers as well. For example, VIEWS are especially nicely described, which demand-dependent web application developers will certainly appreciate. Similarly well treated are the details of the very important concept of indexing.Those who want to go even further and extend the default functionality of PostgreSQL, may do so by writing their own FUNCTIONs in various languages. This is a difficult concept even for experienced developers, but the book does a great job by presenting these via simple yet realistic examples, including concrete code snippets in C and SQL (PL/pgSQL is described in Chapter 7). For me this came very handy with the OMERO database system, where I often needed to add server functionality for various research applications.Naturally, the book also handles the more generic advanced concepts that are used to automate databases, most importantly TRIGGERs.In Chapters 5 and 6 the readers will get a nice summary of the SQL language itself, and of advanced query writing. These concepts may already be familiar to many advanced readers, who may wish to give these chapters just a quick read.In Chapter 7 the authors describe PostgreSQL's default server-side programming language, PL/pgSQL. The advantage of using PL/pgSQL instead of SQL becomes clear very quickly and then the reader is happily immersed in the details of this powerful yet simple language. This chapter is quite long, but worth the effort.No such book would be complete without discussing the subject of data security, and Chapter 8 takes care of this in great detail. Especially nowadays, when hacking is exceptionally common, every database application developer needs to be very careful about security, and this chapter covers this task very well. Those readers who are completely new to the subject may also want to read a more detailed work on general web security, or rely on the experience of professional IT personnel when setting up their servers that will be open to the Internet.When administering a database, we face a certain group of standard tasks, and the book teaches the reader this subject in a cookbook format in Chapter 9. I love this, because here one really appreciates a well described and concrete action plan, rather than lots of theory. Find the task, follow the steps in this chapter, done! For those who want to know more, "There is more..." as the extra paragraphs at the end of each recipe are called; these describe additional ways to achieve the goal, or give more details.For more demanding applications, database optimization is especially important. This may not be a developer's favorite task, but the material in Chapter 10 will help us through it. Lots of ideas about common mistakes, streamlining queries, finding bottlenecks, these are all there. I found many new ideas here, even though I've been coding for databases for many years.The chapter on unconventional data types (Chapter 11) really helps those who customize their database applications heavily. The OMERO example cited above comes to mind here, especially in relation to XML and JSON data handling.A very important but often (somewhat) overlooked part of a developer's job is testing the application. This will be greatly helped by reading Chapter 12 for PostgreSQL coders. Once again a difficult subject, but handled well and smoothly here.Accessing your PostgreSQL database from external applications will be made much easier by Chapter 13, which describes JDBC, a platform that allows communication with PostgreSQL from a Java application. The examples are well structured and cover the most common users' needs.On the related subject of Object-relational mapping, Chapter 14 gives a nice review, including an introduction to the Hibernate framework. This a very advanced subject, but great to have for those on a more advanced level, or those who are aiming for this level.Overall, a well written book with a very wide range of subjects within the realm of PostgreSQL database management and development. Easy to read, free source code for the samples (this is automatic if one buys the book from the publisher, which is what I do; otherwise easily received via e-mail per request), which saves a lot of typing, and great examples throughout.
Amazon Verified review Amazon
O. COSTA Dec 18, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
After a quick read and practicing some sample code, I can say this is a great learning guide for database programming with PostgreSQL.Some valuable information well explained as :relational database compared with others (graph, NoSQL, ...), relational algebra, installation, using client tools, objects in PostgreSQL as SQL components (tables, views, ...) and Object in PostgreSQL as an ORDBMS, DDL, DML and DCL, advanced queries, Common Table Expressions, window functions, UDF in C, encryption (one-way and two-way), unit testing, queries rewriting, optimization in many aspects, user datatypes, benchmark ... java with JDBC api (install, connect, static statement, prepared statements, cursors, calling stored functions) and finally ORM and Hibernate.Authors present an overview of PostgreSQL for developers. Each topic is clearly explained and accompanied by functional and realistic examples, some based on a case study (The car web portal database). This example follows the reader through chapters.Reading this book is pleasant. I enjoyed an easy and very smooth reading for non-English-speaking people. Examples are numerous and facilitate understanding of concepts.It would have been nice to explain inheritance not only for partitioning but also with an example of a specialized child table from a generic table ... as in OOP.Finally, a great book if you are student or professional developer who want to start learning PostgreSQL.
Amazon Verified review Amazon
Oleg Okun Jan 16, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
PostgreSQL is an open source object relational database management system and as open source it is popular in academia and industry. This book provides a solid description of PostgreSQL in one volume that covers many topics that beginners and experienced users likely face at their daily work. At the same time, authors succeeded to put a lot of material into a not too lengthy book. The book is useful for both a BI engineer whose bread-and-butter is SQL programming and a system administrator maintaining, monitoring, and tuning databases. Advanced topics such as views, functions, user-defined data types, database security, database performance optimization, and unit tests for databases are described in sufficient details.
Amazon Verified review Amazon
Andrea Dec 31, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Book purpose is clear: Create, develop, and manage relational databases in real-world applications using PostgreSQL. And the author has over 10 years of experience in industry and academia (you can notice in the first chapter, with a great overview of relational databases).For sure the book is rich of information (with 464 pages and 14 chapters) useful both for admins and developers.Admins can use the first chapters (from 2) to better understand PostgreSQL, but the installation part remain little poor, and some parts, like system related optimization (chapter 10 is dedicated to the optimization aspects, but more at developer level) or high availability deployment are totally missed. Security is covered in chapter 8, both for admins and developers point of view.For sure will be more useful for a developer, also at a beginner level on this DMBS, with lot of information on the SQL and the PL/pgSQL languages and how writing better and advanced queries.There is also a chapter dedicated on Server-Side Programming with PL/pgSQL, useful for complex applications.
Amazon Verified review Amazon
C. Barker Apr 26, 2016
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I have no idea how this book got 5 stars. The book is a non-stop string of informational tidbits with no coherent direction. There seems to be no plan to progress the reader through learning PostgreSQL in any sort of structured way. You'd be better off downloading the PostgreSQL code and trying to understand PostgreSQL that way.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.