JSON Support in PostgreSQL and Entity Framework
JSON 和JSONB的区别(What's difference between JSON and JSONB data type in PosgresSQL?)
- When should be used specific one?
- What's benefits or disadvantages with respect to other?
- JSON比JSONB的一个小的潜在好处是,它保留了数据的缩进。所以,如果你非常关心你的JSON的格式,或者有一些需要它在一个 特定的结构,JSON可能是有用的。(One small potential benefit of it over JSONB (which we’ll get to next) is that it preserves the indentation of the data coming in. So if you are extremely particular about the formatting of your JSON, or have some need for it in a particular structure, JSON can be useful.)Postgres的JSON类型只是在文本字段上提供了JSON验证。 如果你正在存储某种形式的日志数据,你很少需要查询,JSON可以正常工作。 因为它非常简单,所以写入吞吐量会更高。 对于任何更复杂的东西,建议使用JSONB。(Postgres’ JSON type simply provides JSON validation on a text field. If you’re storing some form of log data you rarely need to query, JSON can work fine. Because it’s so simple, it will have a lot higher write throughput. For anything more complex, I’d recommend using JSONB, which is covered below.)
- The B stands for better.JSONB是JSON的二进制表示,这意味着它不仅仅是文本,而是压缩和更高效的存储。它允许嵌套结构,使用基本的数据类型,并有一些内置的函数来处理它。尽管类似于hstore的最好的部分是索引。在JSONB列上创建GIN索引将为该JSON文档中的每个键和值创建一个索引。在文档中嵌套的能力意味着JSONB在大多数情况下优于hstore。
总结:
JSONB - 在大多数情况下
JSON - 如果你只是在处理日志,通常不需要查询,并使用更多的审计跟踪
hstore - 对于基于文本的键值看起来可以正常工作,但是一般来说JSONB在这里仍然可以工作得很好
参考文章:
1.Entity Framework: Storing complex properties as JSON text in database
3.When to use unstructured datatypes in Postgres–Hstore vs. JSON vs. JSONB(重点)
JSON Support in PostgreSQL and Entity Framework的更多相关文章
- Entity Framework 6 vs NHibernate 4
This article is dedicated to discussing the latest releases of the NHibernate and Entity Framework. ...
- Entity Framework + WCF REST JSON Service
利用EF 和WCF 建立一个REST JSON Service. 首先我们要下载一个Visual Studio 的Template 叫 "ADO.NET C# POCO Entity Gen ...
- Entity Framework 6连接Postgresql、SQLite、LocalDB的注意事项和配置文件
Postgresql Postgresql支持Code First的方式自动生成表,不过默认的模式是dbo而不是public,而且还可以自动生成自增主键. <?xml version=" ...
- Entity Framework - PostgresQL CodeFirst
经过几年的更新及业界对Entity Framework 的认同. 现在 EF 可以支持的数据库越来越多了.而PostgresQL 数据库现在也可以使用code first的方式来创建数据库了. 不多说 ...
- .NET Core开发日志——Entity Framework与PostgreSQL
Entity Framework在.NET Core中被命名为Entity Framework Core.虽然一般会用于对SQL Server数据库进行数据操作,但其实它还支持其它数据库,这里就以Po ...
- Newtonsoft.Json高级用法,json序列号,model反序列化,支持序列化和反序列化DataTable,DataSet,Entity Framework和Entity,字符串
原文地址:https://www.cnblogs.com/yanweidie/p/4605212.html 手机端应用讲究速度快,体验好.刚好手头上的一个项目服务端接口有性能问题,需要进行优化.在接口 ...
- PostgreSQL Entity Framework 自动迁移
1.依次添加NuGet包 EntityFramework.Npgsql.EntityFramework6.Npgsql,会自动生成一些配置文件,不过缺少数据库驱动的配置节点: <system.d ...
- Entity Framework 6.0 Tutorials(6):Transaction support
Transaction support: Entity Framework by default wraps Insert, Update or Delete operation in a trans ...
- Entity Framework Tutorial Basics(33):Spatial Data type support in Entity Framework 5.0
Spatial Data type support in Entity Framework 5.0 MS SQL Server 2008 introduced two spatial data typ ...
随机推荐
- [NOI2017]蔬菜
[NOI2017]蔬菜 题目描述 大意就是有\(n\)种物品,第\(i\)个物品有\(c_i\)个,单价是\(a_i\).然后每天你可以卖出最多\(m\)个物品.每天结束后第\(i\)种物品会减少\( ...
- 字符串类型的日期转化为Date类型
//方法一:内部引用package com.th.mobula.test; import java.text.ParseException;import java.text.SimpleDateFor ...
- 003_生成器(generator)内部解析
#http://kb.cnblogs.com/page/87128/(未看完)
- wordpress数据表分析
wordpress一共是有12个表的:|wp_commentmeta || wp_comments || wp_links || wp_options || wp_postmeta || wp_pos ...
- 多线程爬虫爬取详情页HTML
注意:如果想爬取详情页的信息请按须添加方法 import requests import os import re import threading from lxml import etree #爬 ...
- P2257 YY的GCD--洛谷luogu
传送门 题目描述 神犇YY虐完数论后给傻×kAc出了一题 给定N, M,求1<=x<=N, 1<=y<=M且gcd(x, y)为质数的(x, y)有多少对 kAc这种傻×必然不 ...
- 剑指offer——链表中倒数第k个结点
输入一个链表,输出该链表中倒数第k个结点. class Solution { public: ListNode* FindKthToTail(ListNode* pListHead, unsigned ...
- linux日志:syslogd和klogd及syslog
一. 日志守护进程 syslogd和klogd是很有意思的守护进程,syslogd是一个分发器,它将接收到的所有日志按照/etc/syslog.conf的配置策略发送到这些日志应该去的地方,当然也包括 ...
- python logging详解及自动添加上下文信息
之前写过一篇文章日志的艺术(The art of logging),提到了输出日志的时候记录上下文信息的重要性,我认为上下文信息包括: when:log事件发生的时间 where:log事件发生在哪个 ...
- 从CompletableFuture到异步编程设计
从CompletableFuture到异步编程设计,笔者就分为2部分来分享CompletableFuture异步编程设计,前半部分总结下CompletableFuture使用实践,后半部分分享下Com ...