Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Postgres Hstore vs. Redis - performance wise

Postgres Hstore vs. Redis - performance wise


I read about HStores in Postgres something that is offered by Redis as well.

Our application is written in NodeJS. Two questions:

  • Performance-wise, is Postgres Hstore comparable to Redis?

  • for session storage, what would you recommend--Redis, or Postgres with some other kind of data type (like HStore, or maybe even the usual relational table)? And how bad is one option vs the other?

Another constraint, is that we will need to use the data that is already in PostgreSQL and combine it with the active sessions (which we aren't sure where to store at this point, if in Redis or PostgreSQL).

From what we have read, we have been pointed out to use Redis as a Session manager, but due to the PostgreSQL constraint, we are not sure how to combine both and the possible performance issues that may arise.


Problem courtesy of: jribeiro


Redis will be faster than Postgres because Pg offers reliability guarantees on your data (when the transaction is committed, it is guaranteed to be on disk), whereas Redis has a concept of writing to disk when it feels like it, so shouldn't be used for critical data.

Redis seems like a good option for your session data, or heck even store in a cookie or in your client side Javascript. But if you need data from your database on every request then it might not be even worth involving Redis. It very much depends on your application.

Solution courtesy of: Matt Sergeant


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Postgres Hstore vs. Redis - performance wise


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription