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
Mastering PostgreSQL 9.6

You're reading from  Mastering PostgreSQL 9.6

Product type Book
Published in May 2017
Publisher
ISBN-13 9781783555352
Pages 416 pages
Edition 1st Edition
Languages
Author (1):
Hans-Jürgen Schönig Hans-Jürgen Schönig
Profile icon Hans-Jürgen Schönig
Toc

Table of Contents (14) Chapters close

Preface 1. PostgreSQL Overview 2. Understanding Transactions and Locking 3. Making Use of Indexes 4. Handling Advanced SQL 5. Log Files and System Statistics 6. Optimizing Queries for Good Performance 7. Writing Stored Procedures 8. Managing PostgreSQL Security 9. Handling Backup and Recovery 10. Making Sense of Backups and Replication 11. Deciding on Useful Extensions 12. Troubleshooting PostgreSQL 13. Migrating to PostgreSQL

Understanding various stored procedure languages

As already stated previously in this chapter, PostgreSQL gives you the power to write stored procedures in various languages. The following options are available and shipped along with the PostgreSQL core:

  • SQL
  • PL/pgSQL
  • PL/Perl and PL/PerlU
  • PL/Python
  • PL/Tcl and PL/TclU

SQL is the obvious choice to write stored procedures, and it should be used whenever possible as it gives the most freedom to the optimizer. However, if you want to write slightly more complex code, PL/pgSQL might be the language of your choice. It offers flow control and a lot more. In this chapter, some of the more advanced and less known features of PL/pgSQL will be shown (this chapter is not meant to be a complete tutorial on PL/pgSQL).

Then the core contains code to run stored procedures in Perl. Basically, the logic is the same here. Code will be passed as a string and executed by Perl. Remember...

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