---
title: "Postgres goes serverless with Amazon Aurora"
publication: "Postgres Weekly"
issue: 313
published_at: "2019-07-10"
canonical_url: "https://postgresweekly.com/issues/313"
---

The latest Postgres news, articles, tools, and projects.       

#313 — July 10, 2019 

[Read on the Web](https://postgresweekly.com/issues/313)   

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/c6vmpzectzfcgjviu0zg.jpg)](https://aws.amazon.com/blogs/aws/amazon-aurora-postgresql-serverless-now-generally-available/)   

[Amazon Aurora PostgreSQL Serverless Now Generally Available](https://aws.amazon.com/blogs/aws/amazon-aurora-postgresql-serverless-now-generally-available/) — A fair bit to unpack here! [Amazon Aurora](https://aws.amazon.com/rds/aurora/) is a performance-oriented AWS-based database that provides MySQL and Postgres compatibility and charges by the hour. However, the _serverless_ variant auto-scales and lets you simply ‘pay as you go’ (to a point). MySQL has supported this [for a year already](https://aws.amazon.com/blogs/aws/aurora-serverless-ga/), but now Postgres users get their turn to try out the approach. 

Amazon Web Services   

[Generated Columns in Postgres 12](https://www.2ndquadrant.com/en/blog/generated-columns-in-postgresql-12/) — _“The data warehousing community will be happy to know that PostgreSQL now has a feature to generate columns based on data in other columns.”_ And here’s how it works. 

Kirk Roybal   [![\](https://copm.s3.amazonaws.com/8d0ef50d.png)](https://www.gridgain.com/resources/papers/adding-speed-and-horizontal-scale-postgresql?adsource=postgresweekly) 

[In-Memory Computing Adds Speed and Scale to PostgreSQL](https://www.gridgain.com/resources/papers/adding-speed-and-horizontal-scale-postgresql?adsource=postgresweekly) — Combining in-memory computing and PostgreSQL accelerates application performance, powers faster transactions, enables massive scalability, and allows better business analytics—with no rip-and-replace of an existing architecture. [White paper available here](https://www.gridgain.com/resources/papers/adding-speed-and-horizontal-scale-postgresql?adsource=postgresweekly). 

GridGain Systems, Inc sponsor   

[E-Maj 3.1.0: A Way to Log and Rollback Table Updates](https://www.postgresql.org/about/news/1952/) — A Postgres extension which enables fine-grained write logging and ‘time travel’ on subsets of the database. This release now supports Postgres 9.5 through 12. [GitHub repo.](https://github.com/dalibo/emaj) 

Philippe Beaudoin   

[The CSV Output Format in `psql`](https://postgresql.verite.pro/blog/2019/07/06/psql-csv-output.html) — CSV is a convenient and generic (if slightly flaky) data interchange format that Postgres has supported in various ways for years. Postgres 12 takes things a step further by letting `psql` output all tabular results in CSV, if you so choose. 

Daniel Vérité   

[The Fastest Way to Load Data into Postgres with Python](https://hakibenita.com/fast-load-data-python-postgresql) — If you’ve got a large collection of ‘dirty’ data that needs to be fetched and transformed and then entered into Postgres, this is an extensive tutorial that will guide you on the way. 

Haki Benita   

[Postgres's Interval, Date, Timestamp and Time Data Types](https://www.2ndquadrant.com/en/blog/know-what-time-it-is/) — A straightforward introduction to a variety of types that Postgres implements to allow you to represent and work with time durations (also see our Tip of the Week, below, for a related tip). 

Elein Mustain   

[Free eBook: How to Get a 3x Performance Improvement on Your Postgres Database](https://pganalyze.com/ebooks/optimizing-postgres-query-performance?utm_source=PostgresWeeklySecondary) — Learn our best practices for optimizing Postgres query performance for customers like Atlassian and how to reduce data loaded from disk by 500x. 

pganalyze sponsor   

[Generate Primary Keys (Almost) Automatically](https://fluca1978.github.io/2019/07/09/GeneratePrimaryKeys.html) — Maybe I live a sheltered existence but I can’t think of a reason I’d want to do this.. but it’s good to know I can(!) 

Luca Ferrari   

[Serving Dynamic Vector Tiles from PostGIS](https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis) — PostGIS extends Postgres into a powerful geographic and geospatial data engine which can also produce and work with tiled maps. 

Paul Ramsey   

[Terraform PostgreSQL Provider](https://github.com/terraform-providers/terraform-provider-postgresql) — [Terraform](https://www.terraform.io/) is a popular code-based infrastructure management system. 

Terraform       supported by [![EnterpriseDB\](https://res.cloudinary.com/cpress/image/upload/v1562592058/ejysjrwdn0ew88ofido4.png)](https://www.enterprisedb.com/)  

💡 Tip of the Week 

Using `date_trunc` to reduce time precision 

`date_trunc` is one of many [date/time functions](https://www.postgresql.org/docs/9.1/functions-datetime.html) built into Postgres, but certainly scores high in its bang for the buck for me. 

`date_trunc` _truncates_ timestamps to a certain level of precision, such as a specific hour, second, day, week, year, or so on. 

As an example, let's create a _very_ simple `orders` table which stores solely the time an order is created:  

CREATE TABLE orders (created_at timestamp);
 
 INSERT INTO orders VALUES
 ('2019-01-01 04:05:33'),
 ('2019-01-01 09:05:51'),
 ('2019-01-03 02:55:14'),
 ('2019-01-08 14:12:07');   

Now, we can use `date_trunc` upon `created_at` to, say, group and count orders by day or week:  

SELECT date_trunc('day', created_at) AS day,
 COUNT(created_at) FROM orders
 GROUP BY day
 ORDER BY day;  

day | count
 ----------------------------
 2019-01-01T00:0 ... | 2
 2019-01-08T00:0 ... | 1
 2019-01-03T00:0 ... | 1   

This basic example shows that if we group by `created_at` truncated to the `day` level, we can count how many orders there were on each unique day. 

This week's tip is sponsored by _[EnterpriseDB](https://www.enterprisedb.com/enterprise-postgres/edb-postgres-platform)_, the most complete open-source database platform. [Learn more about our enterprise Postgres solutions](https://www.enterprisedb.com/enterprise-postgres/edb-postgres-platform).      

🗓 Upcoming Postgres Events 

- [PGConf.Brasil 2019](https://www.pgconf.com.br/2019/en/) (August 1-3 in São Paulo) — A three day conference with talks, tutorials, courses, and lightning talks.
- [PGDay Austria 2019](https://pgday.at/en/) (September 6 in Wiener Neustadt, Austria)
- [PostgreSQL Conference Asia 2019](http://2019.pgconf.asia/) (September 9-12 in Bali, Indonesia)
- [PostgresConf South Africa 2019](https://postgresconf.org/conferences/SouthAfrica2019) (October 8-9 in Johannesburg) — An opportunity for the database administration and developer community who use Postgres to get to know each other.          

Curated by [Cooperpress](https://cooperpress.com/) and [Craig Kerstiens](https://twitter.com/craigkerstiens). 

[Change your email address](https://postgresweekly.com/edit_subscription/*|UID|*) or[Stop getting this newsletter](https://postgresweekly.com/leave/*|UID|*) 

© Cooper Press Ltd · Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom
