---
title: "How hash indexes can actually be good"
publication: "Postgres Weekly"
issue: 388
published_at: "2021-01-13"
canonical_url: "https://postgresweekly.com/issues/388"
---

Plus RDS now supports pg_cron, using R with Postgres, and how Postgres is 'boring.' |        

#388 — January 13, 2021 

[Web Version](https://postgresweekly.com/issues/388)   

Postgres Weekly 

[![\](https://res.cloudinary.com/cpress/image/upload/w_1280,e_sharpen:60/x4d9guyjlctepjwgtnre.jpg)](https://hakibenita.com/postgresql-hash-index)   

[Re-Introducing Hash Indexes in Postgres](https://hakibenita.com/postgresql-hash-index) — Billed as the ‘ugly duckling of index types’, this is a look at an uncommonly used type of index whose use was discouraged in the past but whose performance can sometimes beat the trusty B-tree as we see here. 

Haki Benita   

[`int4` vs. `float4` vs. `numeric`](https://www.cybertec-postgresql.com/en/postgresql-int4-vs-float4-vs-numeric/) — Postgres offers many different data types and this post focuses on three important ones for storing numbers and their differences. 

Hans-Jürgen Schönig   [![\](https://copm.s3.amazonaws.com/e6b1ea55.png)](https://pganalyze.com/ebooks/efficient-search-in-rails-with-postgres?utm_source=PostgresWeeklyPrimary01132021) 

[Free eBook: Efficient Search in Rails with Postgres](https://pganalyze.com/ebooks/efficient-search-in-rails-with-postgres?utm_source=PostgresWeeklyPrimary01132021) — Speed up a search query from seconds to milliseconds and learn about exact matches, trigrams, ILIKE, and full-text search. 

pganalyze sponsor   

[Amazon RDS for PostgreSQL Supports 12.5, 11.10, 10.15, 9.6.20, and 9.5.24](https://aws.amazon.com/about-aws/whats-new/2021/01/amazon-rds-postgresql-supports-new-minor-versions/) — Support has also been added for pg_cron (for [scheduling maintenance commands](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL_pg_cron.html)) and pg_partman (for [managing partitions](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL_Partitions.html)). 

Amazon Web Services   

[Waiting for Postgres 14: Add `idle_session_timeout`](https://www.depesz.com/2021/01/12/waiting-for-postgresql-14-add-idle_session_timeout/) — Have sessions terminated when they’re been waiting around for too long. 

Hubert depesz Lubaczewski   

[Using R in Postgres for Logistic Regression Modeling](https://info.crunchydata.com/blog/using-r-in-postgres-for-logistic-regression-modeling-1) — Continuation of a ‘Postgres for Data Science’ series of posts that moves on to doing data modeling and fire occurrence predictions with R right from the database. 

Steve Pousty   

[How to Limit Rows to At Most N Per Category (Take Two)](https://www.depesz.com/2021/01/08/how-to-limit-rows-to-at-most-n-per-category-fix/) — Several issues ago we linked to [a handy tutorial](https://www.depesz.com/2020/11/24/how-to-limit-rows-to-at-most-n-per-category/) demonstrating how to limit the rows returned by a query to a certain number per some second condition. It had a problem related to concurrency, however, so Hubert has a second go at it here. 

Hubert depesz Lubaczewski   

[⏰ 12 Things You Need to Know About Time-Series Data](https://tsdb.co/12-things-time-series) — [Get our top advice and time-series resources](https://tsdb.co/12-things-time-series), from PostgreSQL pro tips and example projects to database benchmarks & more. 

Timescale sponsor   

[Sysbench: In-Memory Postgres, Postgres Is Boring](http://smalldatum.blogspot.com/2021/01/sysbench-in-memory-postgres-postgres-is.html) — Sometimes no news is good news. _“I am happy to claim that Postgres is boring as there are no CPU regressions from version 11 to 13.”_ 

Mark Callaghan   

[Hosting Postgres on an AWS EC2 t4g Graviton2 ARM Instance](https://www.pedroalonso.net/blog/hosting-postgresql-on-a-t4g-graviton2-arm-instance-on-aws-ec2) — Sure, AWS has its managed RDS service for running Postgres, but if you fancy trying it out on EC2’s newer ARM-based instances, here are some pointers. 

Pedro Alonso   

[The Mapping of `oid` and `relfilenode`](https://www.highgo.ca/2021/01/12/the-mapping-of-oid-and-relfilenode-in-pg/) — Technical ‘under the covers’ stuff about how the location of tables are tracked internally. Few people _need_ to understand this, but perhaps many more would _like_ to :-) 

Movead Li    

🔧**Tools and Code**  

[pg_back 1.10: A Bash Script for Dumping Databases to Files](https://www.postgresql.org/about/news/pg_back-110-released-2146/) — Essentially a wrapper around `pg_dumpall` and `pg_dump` to add a bit more structure to a simple database backup process. [GitHub repo.](https://github.com/orgrim/pg_back) 

Nicolas Thauvin   

[PostgresNIO: Non-Blocking, Event-Driven Client for Swift](https://github.com/vapor/postgres-nio) 

Vapor   

[PGMoon 1.12.0: A Pure Lua Postgres Driver for Use in OpenResty and More](https://github.com/leafo/pgmoon) 

leaf    

**Got a new email?** You can [change your address here](https://postgresweekly.com/edit_subscription/*|UID|*). 

--- 

**Bored of us?** [Click here to stop getting Postgres Weekly](https://postgresweekly.com/leave/*|UID|*). 

--- 

**Got a link for us?** Reply and tell us. We can't include everything but we'll look at anything you send. Thanks! 

--- 

**Want more?** You might like [DB Weekly](https://dbweekly.com/?utm_source=pg&utm_medium=email&utm_campaign=footer-promo), our more general database newsletter covering data storage trends, new database types, and more. 

--- 

Published by Cooper Press Ltd.
Fairfield Enterprise Centre, Louth, LN11 0LS, United Kingdom 

[Stop getting this newsletter.](https://postgresweekly.com/leave/*|UID|*)
