# Postgres Datatypes - The ones you're not using.

DevFeed: [Postgres Datatypes - The ones you're not using.](<https://devfeed.tech/articles/postgres-datatypes-the-ones-you-re-not-using-41168.md>)

Original publisher: [Read original article](<https://www.craigkerstiens.com/2014/05/07/Postgres-Datatypes-The-ones-youre-not-using./>)

Author: Map

Published: 2014-05-07T20:55:56Z

Content type: article

Language: en

Sources: [Craig Kerstiens](<https://devfeed.tech/sources/craig-kerstiens.md>)

Topics: [data type](<https://devfeed.tech/topics/data-type.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [arrays](<https://devfeed.tech/tags/arrays.md>), [database](<https://devfeed.tech/tags/database.md>), [extension](<https://devfeed.tech/tags/extension.md>), [gin](<https://devfeed.tech/tags/gin.md>), [gist](<https://devfeed.tech/tags/gist.md>), [hstore](<https://devfeed.tech/tags/hstore.md>), [indexes](<https://devfeed.tech/tags/indexes.md>), [key-value-store](<https://devfeed.tech/tags/key-value-store.md>), [migration](<https://devfeed.tech/tags/migration.md>), [performance](<https://devfeed.tech/tags/performance.md>), [postgres](<https://devfeed.tech/tags/postgres.md>), [postgresql](<https://devfeed.tech/tags/postgresql.md>), [range](<https://devfeed.tech/tags/range.md>), [text](<https://devfeed.tech/tags/text.md>), [timestamps](<https://devfeed.tech/tags/timestamps.md>), [timezone](<https://devfeed.tech/tags/timezone.md>), [types](<https://devfeed.tech/tags/types.md>)

## AI overview

The excerpt recommends several PostgreSQL types for specific needs: hstore stores optional key-value data without adding columns and can use GIN or GiST indexes, but requires an extension; range types can constrain intervals to prevent overlaps; and timestamptz supports timezone conversion. It presents UUIDs as potentially useful for large applications where integer keys may cause scaling or sharding problems. The text describes indexed binary JSON as upcoming in PostgreSQL 9.4, while cautioning against money because it assumes one currency and has caveats compared with numeric. Arrays, interval, ISN, and inet are briefly listed as other options.

## Source excerpt

Postgres has a variety of datatypes, in fact quite a few more than most other databases. Most commonly applications take advantage of the standard ones - integers, text, numeric, etc. Almost every application needs these basic types, the rarer ones may be needed less frequently. And while not needed on every application when you do need them they can be an extremely handy. So without further ado let's look at some of these rarer but awesome types. hstore Yes, I've talked about this one before, yet still not enough people are using it. Of this list of datatypes this is one that could also have benefit for most if not all applications. Hstore is a key-value store directly within Postgres. This means you can easily add new keys and values (optionally), without haveing to run a migration to setup new columns. Further you can still get great performance by using Gin and GiST indexes with them, which automatically index all keys and values for hstore. It's of note that hstore is an extension and not enabled by default. If you want the ins and outs of getting hands on with it, give the article on Postgres Guide a read. Range types If there is ever a time where you have two columns in your database with one being a from, another being a to, you probably want to be using range types. Range types are just that a set of ranges. A super common use of them is when doing anything with calendaring. The place where they really become useful is in their ability to apply constraints on those ranges. This means you can make sure you don't have overlapping time issues, and don't have to rebuild heavy application logic to accomplish it. Timestamp with Timezone Timestamps are annoying, plain and simple. If you've re-invented handling different timezones within your application you've wasted plenty of time and likely done it wrong. If you're using plain timestamps within your application further there's a good chance they dont even mean what you think they mean. Timestamps with timezone o