TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

JSON vs hstore

36 pointsby ishbitsalmost 12 years ago

6 comments

wh-uwsalmost 12 years ago
So I&#x27;m using both types in a current personal project and I have to agree with the comment on the blog post<p>&quot;[...] I use JSON for external application data that doesn’t need to be interpreted by say, an SQL function or a trigger. Basically storage-only data...&quot;<p>Basically I use hstore&#x27;s as meta columns, for say a one off attribute of a model that I dont want to have as another column and have to do a migration. It is leaps and bounds better than using a text column because you can query.<p>JSON I use for basically caching api calls. For instance I save off the json from the itunes api for all of the albums of an artist or all of their songs.<p>It will be awesome when 9.3 comes out and you can query that though. That will be something.
NatWalmost 12 years ago
I also think of this in terms of viable development migration paths:<p>For example, 9.3&#x27;s upcoming: hstore_to_json(hstore) and hstore_to_json_loose(hstore) open up possibilities. If an hstore datatype is chosen now, you can feel fairly confident that it can be fairly straightforwardly migrated to a native json datatype in 9.3 or later versions, when you feel the json featureset and stability may have become mature enough for your particular project&#x27;s needs.
moominalmost 12 years ago
Now all we need is EDN support in Postgres.
craigkerstiensalmost 12 years ago
Here&#x27;s the original post which fired off some further clarifications from Christophe:<p><a href="http://www.craigkerstiens.com/2013/07/03/hstore-vs-json/" rel="nofollow">http:&#x2F;&#x2F;www.craigkerstiens.com&#x2F;2013&#x2F;07&#x2F;03&#x2F;hstore-vs-json&#x2F;</a>
zapovalmost 12 years ago
I&#x27;m really failing to understand obsession with unstructured types in Postgres? Why can&#x27;t you just use native types for hierarchical structures?<p>Is it really that hard for people to maintain database changes?
评论 #5992389 未加载
评论 #5992401 未加载
评论 #5993368 未加载
评论 #5992379 未加载
reczyalmost 12 years ago
a bit more hands-on, but it&#x27;s possible to create a functional index to improve json query performance in postgres:<p><a href="https://postgres.heroku.com/blog/past/2013/6/5/javascript_in_your_postgres/" rel="nofollow">https:&#x2F;&#x2F;postgres.heroku.com&#x2F;blog&#x2F;past&#x2F;2013&#x2F;6&#x2F;5&#x2F;javascript_in...</a>