数据库 PostgreSQL9.4: 不再为选择关系型还是非关系型数据库而苦恼

googya · December 19, 2014 · Last by nine replied at February 26, 2015 · 5863 hits

9.4 发布了,其中提到:

With the new JSONB data type for PostgreSQL, users no longer have to choose between relational and non-relational data stores: they can have both at the same time. JSONB supports fast lookups and simple expression search queries using Generalized Inverted Indexes (GIN). Multiple new support functions enable users to extract and manipulate JSON data, with a performance which matches or surpasses the most popular document databases. With JSONB, table data can be easily integrated with document data for a fully integrated database environment.

http://www.postgresql.org/about/news/1557/

这看起来挺不错的,实践起来真的好么?

PG 的几种数据类型:

array 元素类型固定 hstore 只支持 {字符串 => 字符串} json 比 hstore 更灵活,操作也很快 jsonb 比 json 占用体积大,不过支持的操作比 json 多,例如做对象相等性比较 (键顺序不同的也可以当作相同) jsonb 还有 mongodb 不支持的交并集运算等等操作,非常好用,简单的 sql 就能搞定 一大坨 map reduce 做的事情

数据库了解这些类型,都是可以索引进去,或者查询一部分返回的

不加外键用 uuid 表就不用锁定集群了,可以达到 nosql 的 scale 效果...

一直都是 PG,用过 hstore 和 json,感觉还是很方便的,但高级功能用得比较少

不知道 PostgreSQL9.3.5 升级到 PostgreSQL9.4 麻烦不?

9.4 关键是为 jsonb 提供更多实用的函数,新类型只是附赠的。

#5 楼 @imlcl 😄 不好意思,打少一个 9,已修改。

很强大 测试了 array 和 jsonb 之后,开始全面转向 PG 了 表的数量能减少 1/3,解决很多烦恼啊

You need to Sign in before reply, if you don't have an account, please Sign up first.