SQL Optimistic Lock in .Net
Once again, I've encountered a concurrency issue recently. The data I attempted to modify didn't yield the desired results. There's evidence showing that more than two applications accessed this data simultaneously. Identifying the application exhibiting conflicting behavior is really difficult. Optimistic locking is a solution for this issue.
Large Jsonb Value Performance in Postgres
Introduction
Recently, our team encountered some performance issues with our APIs. Typically, such issues arise from inefficient querying strategies. However, we stumbled upon a particularly interesting case. This specific API was solely responsible for update operations.In this post, we'll share our experience with this unique case and delve into the JSONB performance during update actions within PostgreSQL.
如何在EFCore中使用Posrgres的Jsonb(2)
雖然在設計階段應該避免讓
Jsonb
的資料成為查詢條件,但開發的時候仍然難以避免這樣的需求。Postgres針對Jsonb
的查詢提供了不少高效的API,如果想要搭配EFCore
使用就會需要預先定義型別或者搭配JsonDocument
使用。
如何在EFCore中使用Posrgres的Jsonb(1)
Postgres
中有一個特殊的Jsonb
型別,可以用來存放Json
格式的資料,資料庫會對Json
的節點做一定的整理。使用這個型別能夠在關聯式資料庫嚴格的限制下取得一定的彈性,讓我們在享有SQL
的保證時同時享受NoSQL
的彈性。然而針對EFCore
這種對資料庫抽象化的ORM
框架來說,Jsonb
的查詢與寫入屬於Postgres
的特化功能,需要靠額外的方式來達到支援。因為最近專案中又使用到Jsonb
來保存部份資料,重新看一次文件後稍微調整了一下這次的作法。