---
title: "Moving from a graph database to Postgres, When to use Hstore, JSON and JSONB"
publication: "Postgres Weekly"
issue: 166
published_at: "2016-07-20"
canonical_url: "https://postgresweekly.com/issues/166"
---

Postgres Weekly 166   . 

[Read this on the Web](http://postgresweekly.com/issues/166) 

[Postgres Weekly](http://postgresweekly.com) Issue 166 — July 20, 2016     

[Our Journey From Graph Databases to PostgreSQL](http://engineering.hipolabs.com/graphdb-to-postgresql/?utm_source=postgresweekly&utm_medium=email)Graph databases have their time and place but just because you _can_ do something in a graph database doesn’t mean it’s ideal. Here, follow a journey taken from Mongo to Neo4j to Postgres. Engineering at Hipo [When to Use Unstructured Datatypes - Hstore vs. JSON vs. JSONB](https://www.citusdata.com/blog/2016/07/14/choosing-nosql-hstore-json-jsonb/?utm_source=postgresweekly&utm_medium=email)Postgres has had schemaless data types for years. With hstore, JSON, and JSONB there are various trade-offs, pros and cons, as well as the broader question of when to use them at all. Citus Data [PostgreSQL Conference Europe Registration Open](https://www.postgresql.org/about/news/1683/?utm_source=postgresweekly&utm_medium=email)It’s in Estonia on November 1-4. postgresql.​org#news [Corgis Eat Tech Debt for Breakfast](http://corgibytes.com/)Need to crank out features faster? Corgibytes cleans up technical debt that gets in the way of rapid release cycles. One client doubled their productivity with zero new hires. Don’t let tech debt slow you down. Call the Corgis. Corgibytes#sponsored[![\](https://copm.s3.amazonaws.com/4a818ece.png)](http://corgibytes.com/) [Optimizing DISTINCT Performance](https://explainextended.com/2009/05/03/postgresql-optimizing-distinct/?utm_source=postgresweekly&utm_medium=email)Counts in Postgres tend to be slow, but if you need faster counts there are a few things you can use from sketch algorithms like hyperloglog to custom functions which can utilize indexes as shown here. EXPLAIN EXTENDED [Inheritance: One More Reason to Love PostgreSQL](http://www.cybertec.at/2016/07/inheritance-one-more-reason-to-love-postgresql/?utm_source=postgresweekly&utm_medium=email)A brief look at table inheritance in Postgres, if you’re not already familiar with it. Hans-Juergen Schoenig#tutorial [Thinking in SQL vs Thinking in Python](https://blog.modeanalytics.com/learning-python-sql/?utm_source=postgresweekly&utm_medium=email) Benn Stancil#opinion [Query Array of Objects in Postgres](http://dustinmartin.net/query-json-array-of-objects-in-postgres-2/?utm_source=postgresweekly&utm_medium=email)Storing data in a JSON column in Postgres can be very handy but a bit more difficult to query than normal tables. This quick tip highlights how to query and filter if you have an array of data in a simpler way using some of the built-in json/array functions. Dustin Martin [Analyzing PostgreSQL Logs with pgBadger](https://blog.garage-coding.com/2016/07/16/analyzing-postgres-logs-with-pgbadger.html?utm_source=postgresweekly&utm_medium=email)pgBadger is one tool to help you parse Postgres logs and get insights into your database. Here’s a great primer to get up and running. garage-coding.​com [New Versions of Postgres Migration Toolkit Released](http://www.convert-in.com/pgskit.htm?utm_source=postgresweekly&utm_medium=email) Intelligent Converters#news [Stop wasting time - know what you'll earn before the interview](https://hired.com/?utm_source=newsletters&utm_medium=petercooperpress&utm_campaign=q3-16-postgresweekly)On Hired, sign up in 10 minutes and get offers from top companies like GitHub, Uber, & Stripe. Engineers get an average of 5 offers on the platform in 1 week Hired.​com#job    

Postgres Weekly is curated by [Craig Kerstiens](https://twitter.com/craigkerstiens) [Read this issue on the Web](http://postgresweekly.com/issues/166) [See our archives](http://postgresweekly.com/issues) [Change your email address](*|UPDATE_PROFILE|*)  [Stop getting this newsletter](*|UNSUB|*)  

Published by [Cooperpress](https://cooperpress.com/)
Fairfield Enterprise Centre, Lincoln Way, Louth, LN11 0LS, UK
