The Distributed SQL Blog

Thoughts on distributed databases, open source and cloud native

YugaByte DB Engineering Update – June 27, 2019

VP Marketing and Community

YugaByte DB Release Updates

We are pleased to announce that YugaByte DB 1.2.11 is live! You can read the release notes of this and previous versions here. This release is shipping with stored procedures support, plus 30 new features, enhancements and bug fixes. Here’s a few highlights from the 1.2.11 release.

What’s YSQL? It’s YugaByte DB’s PostgreSQL-compatible, distributed SQL API.

[#1155] Support for FUNCTION and PROCEDURE

Stored procedures allow developers to “bundle up” operations that would otherwise take several queries and round trips into a single function. Stored procedures also help minimize duplicate code, as developers can reuse existing stored procedures to perform the same actions. What’s the difference between a FUNCTION and a PROCEDURE? A function cannot execute transactions. In other words, inside a function you cannot open a new transaction, even commit or rollback the current transaction. In PostgreSQL 11, stored procedures with transactional support were introduced to remedy this problem.

Note: You’ll need to enable ysql_beta_features flag on your cluster to try out this feature.

[#870] Allow WITH clauses in CREATE TABLE

In PostgreSQL, the WITH clause is used in CREATE TABLE statements to specify storage parameters or primary keys in system tables, also known as object identifiers or OIDs. Although, PostgreSQL storage parameters aren’t relevant to tables stored in YugaByte because it handles data distribution differently, some standard utilities such as pgbench submit DDL statements with this clause.

Getting Started with Stored Procedures

Enable the FUNCTIONS Flag

If you haven’t already installed YugaByte DB, do so by following the first two steps in our quickstart.

Restart your cluster to enable the stored procedure feature:

./bin/yb-ctl restart --tserver_flags="ysql_beta_features=true"

Open up the YSQL Shell

Before executing any SQL, we’ll need to be in the YSQL shell. You can access it by executing:

Create an Accounts Table

Insert Data Into the Accounts Table

Verify the Data in the Accounts Table

Create a Stored Procedure

The following example creates a stored procedure named transfer that transfers a specified amount of money from one account to another.

Calling the Stored Procedure

Next, let’s call the transfer stored procedure and transfer $1000 from an account with id 1 (Bob) to the account with id 2 (Alice).

Verify the Transfer of Money

New Documentation, Blogs and Videos

New Blogs

New Docs

Upcoming Meetups and Conferences

We will be at a number of conferences and meetups over the next few months, below are some select few with the highlights. Do stop by, say hello and ask us any questions you have.

PostgreSQL Meetups

SpringOne Tour

SpringOne Platform

AWS re:Invent

We are Hiring!

YugaByte is growing fast and we’d like you to help us keep the momentum going! Check out our currently open positions:

Our team consists of domain experts from leading software companies such as Facebook, Oracle, Nutanix, Google and LinkedIn. We have come a long way in a short time but we cannot rest on our past accomplishments. We need your ideas and skills to make us better at every function that is necessary to create the next great software company. All while having tons of fun and blazing new trails!

Get Started

Ready to start exploring YugaByte DB features? Getting up and running locally with a three node cluster on your laptop is fast. Just download, extract, create the cluster, check its status and your ready to go!

What’s Next?

  • Using YugaByte at your company? Tell us about it and we’ll send you a hoodie!
  • Compare YugaByte DB in depth to databases like CockroachDB, Google Cloud Spanner and MongoDB.
  • Get started with YugaByte DB on macOS, Linux, Docker, and Kubernetes.
  • Contact us to learn more about licensing, pricing or to schedule a technical overview.

Related Posts

VP Marketing and Community