Article Source

  • Title: NoSQL Distilled; A Brief Guide to the Emerging World of Polyglot Persistence, 2013.
  • Authors: Pramod J. Sadalage, Martin Fowler

Key-Value Model and Document Data Model

키-값 데이터베이스와 문서 데이터베이스는 강력하게 집합 지향적이다. 이런 데이터베이스는 주로 집합을 통해 구축됨을 뜻한다. 이 두 형태의 데이터베이스는 모두 많은 집합으로 구성되어 있고 각 집합은 데이터를 얻는 데 사용하는 키나 아이디를 가지고 있다.

두 모델은 차이가 있다. 키-값 데이터베이스에서는 집합 구조가 불투명하다. 즉 대부분 의미 없는 바이너리 데이터처럼 취급된다. 이와 반대로 문서 데이터베이스는 집합의 구조를 볼 수 있다. 불투명성의 장점은 집합 안에 무엇이든 저장할 수 있다는 점이다. 데이터베이스에 일반적인 크기 제한 같은 것은 있을 수 있지만, 그 외에는 완전 자유다. 문서 데이터베이스는 집합에 허용되는 구조와 타입을 정의해 그 안에 들어갈 수 있는 것을 제한한다. 그러나 데이터에 접근할 때 융통성이 더 많다.

키-값 저장소에서는 키를 통해서만 집합에 접근할 수 있다. 문서 데이터베이스에서는 집합의 필드를 이용해 데이터베이스에 질의를 보낼 수 있고, 집합의 전체 대신 일부를 조회할 수 있으며, 집합의 내용을 이용해 인덱스를 만들 수도 있다.

실제로는 키-값 저장소와 문서 데이터베이스 간 구분이 조금 모호해졌다. 사람들은 키-값 형식으로 검색하려고 문서 데이터베이스에 ID 필드를 넣기도 한다. 키-값 데이터베이스로 분류된 데이터베이스는 불투명한 집합 이상의 데이터 구조 정의를 허용한다. 예를 들어 리악은 인덱스 생성이나 집합 간 연결을 위한 메타데이터 추가를 허용하고, 레디스(Redis)는 집합을 리스트나 집합(set)으로 분해하는 것을 허용한다. 솔라(Solr) 같은 검색 도구를 통합해 쿼리를 지원할 수도 있다. 예로 리악에는 JSON이나 XML 구조로 저장된 집합에 솔라와 비슷한 방식으로 검색을 실행할 수 있는 기능이 포함되어 있다.

모호한 면이 있기는 하지만 일반적인 구분은 여전히 유효하다. 키-값 데이터베이스에서는 키를 통해 집합을 찾는다. 문서 데이터베이스에서는 문서 내부 구조를 기초로 어떤 형태의 쿼리를 실행한다. 키를 사용할 수도 있지만 대부분의 경우는 다른 것을 사용한다.


We said earlier on that key-value and document databases were strongly aggregate-oriented. What we meant by this was that we think of these databases as primarily constructed through aggregates. Both of these types of databases consist of lots of aggregates with each aggregate having a key or ID that’s used to get at the data.

경축! 아무것도 안하여 에스천사게임즈가 새로운 모습으로 재오픈 하였습니다.
어린이용이며, 설치가 필요없는 브라우저 게임입니다.
https://s1004games.com

The two models differ in that in a key-value database, the aggregate is opaque to the database—just some big blob of mostly meaningless bits. In contrast, a document database is able to see a structure in the aggregate. The advantage of opacity is that we can store whatever we like in the aggregate. The database may impose some general size limit, but other than that we have complete freedom. A document database imposes limits on what we can place in it, defining allowable structures and types. In return, however, we get more flexibility in access.

With a key-value store, we can only access an aggregate by lookup based on its key. With a document database, we can submit queries to the database based on the fields in the aggregate, we can retrieve part of the aggregate rather than the whole thing, and database can create indexes based on the contents of the aggregate.

In practice, the line between key-value and document gets a bit blurry. People often put an ID field in a document database to do a key-value style lookup. Databases classified as key-value databases may allow you structures for data be “yond just an opaque aggregate. For example, Riak allows you to add metadata to aggregates for indexing and interaggregate links, Redis allows you to break down the aggregate into lists or sets. You can support querying by integrating search tools such as Solr. As an example, Riak includes a search facility that uses Solr-like searching on any aggregates that are stored as JSON or XML structures.

Despite this blurriness, the general distinction still holds. With key-value databases, we expect to mostly look up aggregates using a key. With document databases, we mostly expect to submit some form of query based on the internal structure of the document; this might be a key, but it’s more likely to be something else.

 

[출처] http://sungsoo.github.io/2014/05/18/key-value-and-document-data-model.html

 

 

본 웹사이트는 광고를 포함하고 있습니다.
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
번호 제목 글쓴이 날짜 조회 수
공지 오라클 기본 샘플 데이터베이스 졸리운_곰 2014.01.02 86311
공지 [SQL컨셉] 서적 "SQL컨셉"의 샘플 데이타 베이스 SAMPLE DATABASE of ORACLE 가을의 곰을... 2013.02.10 78768
공지 [G_SQL] Sample Database 가을의 곰을... 2012.05.20 95516
14 [SQLite]10만 TPS와 10억 행 처리: SQLite의 놀라운 효율성 졸리운_곰 2025.12.05 1184
13 [sqlite] SQlite source code analysis-architecture file 졸리운_곰 2021.04.12 1809
12 [SQLite] SQLite 사용자 함수 추가 졸리운_곰 2021.04.12 1665
11 {SQLite] SQLite 페이지 핸들링(3) - 레코드 포맷 졸리운_곰 2021.04.12 1668
10 [SQLite] SQLite 페이지 핸들링(2) - SQLite의 페이지 포맷 file 졸리운_곰 2021.04.12 1496
9 [SQLite] SQLite 페이지 핸들링(1) - SQLite의 구조 file 졸리운_곰 2021.04.12 1487
8 [C/C++ 자료구조] SQLite 의 모든 것 (4부) - Java 에서 사용하기 Database/SQLite file 졸리운_곰 2021.04.12 1663
7 [C/C++] SQLite 의 모든 것 (3부) - C++ 에서 사용하기 Database/SQLite 졸리운_곰 2021.04.12 1720
6 [C/C++ 자료구조] SQLite 의 모든 것 (2부) - Download & Build Database/SQLite file 졸리운_곰 2021.04.12 1667
5 [C/C++ 자료구조] SQLite 의 모든 것 (1부) - 소개 및 FAQ Database/SQLite file 졸리운_곰 2021.04.12 1332
4 SQLite-sync.com version 3 file 졸리운_곰 2017.07.03 2018
3 DB Browser for SQLite file 졸리운_곰 2017.04.26 1652
2 Getting started with SQLite in C# file 졸리운_곰 2017.04.24 1828
1 SQLite C/C++ Tutorial 졸리운_곰 2017.04.24 1497
대표 김성준 주소 : 경기 용인 분당수지 U타워 등록번호 : 142-07-27414
통신판매업 신고 : 제2012-용인수지-0185호 출판업 신고 : 수지구청 제 123호 개인정보보호최고책임자 : 김성준 sjkim70@stechstar.com
대표전화 : 010-4589-2193 [fax] 02-6280-1294 COPYRIGHT(C) stechstar.com ALL RIGHTS RESERVED