Programing

데이터베이스 샤딩 및 파티션

lottogame 2020. 7. 13. 08:13
반응형

데이터베이스 샤딩 및 파티션


최근에 확장 가능한 아키텍처에 대해 읽었습니다. 이와 관련하여 데이터베이스와 관련하여 계속 표시되는 두 단어는 샤딩파티셔닝 입니다. 나는 설명을 찾았지만 여전히 혼란 스러웠다.

stackoverflow의 전문가가 기본을 올바르게 얻는 데 도움이 될 수 있습니까?

  • 샤딩파티셔닝 의 차이점은 무엇입니까 ?
  • 그것은 사실인가 '모든 분산됩니다 데이터베이스가 기본적으로 (서로 다른 노드 이상) 분할되어 있지만, 모든 분할 된 데이터베이스가 반드시 분산됩니다되지 않습니다' ?

파티셔닝은 테이블 또는 데이터베이스간에 데이터를 나누는 일반적인 용어입니다. 샤딩은 특정 유형의 파티셔닝, 즉 수평 파티셔닝입니다.

여기도 참조하십시오 : http://www.quora.com/Whats-the-difference-between-sharding-and-partition


다음은 두 가지 질문 모두에 대한 답변입니다.

수평 파티셔닝은 일반적으로 스키마 및 데이터베이스 서버의 단일 인스턴스 내에서 하나 이상의 테이블을 행별로 분할합니다. 인덱스를 먼저 검색 할 필요없이 특정 행을 찾을 테이블을 식별 할 수있는 명확하고 강력하며 암시적인 방법이있는 경우 인덱스 크기를 줄임으로써 (따라서 검색 노력) 이점을 제공 할 수 있습니다. 'CustomersEast'및 'CustomersWest'테이블의 예. 우편 번호는 이미 찾을 위치를 나타냅니다.

샤딩 (Shading)은 문제를 뛰어 넘습니다. 문제가있는 테이블을 같은 방식으로 분할하지만 잠재적으로 여러 스키마 인스턴스에서이를 수행합니다. 큰 분할 된 테이블에 대한 검색로드를 이제 동일한 논리 서버의 여러 인덱스뿐만 아니라 여러 서버 (논리적 또는 물리적)로 나눌 수 있다는 것이 명백한 이점입니다.

출처 : Wiki-Shard .

샤딩은 여러 머신에 데이터 레코드를 저장하는 프로세스이며 데이터 증가 요구를 충족시키기위한 MongoDB의 접근 방식입니다. 데이터의 크기가 증가함에 따라 단일 시스템으로는 데이터를 저장하거나 읽기 및 쓰기 처리량을 수용하기에 충분하지 않을 수 있습니다. 샤딩은 수평 스케일링 문제를 해결합니다. 샤딩을 사용하면 데이터 증가 및 읽기 및 쓰기 작업 요구를 지원하는 머신을 더 추가 할 수 있습니다.

출처 : MongoDB를 .


나는 이것에 대해서도 뛰어 들었으며, 그 문제에 대한 언급은 많지 만 수집 한 주요 사실과 공유하고 싶은 점이 거의 없습니다.

파티션은 논리적으로 별개의 데이터베이스 또는 독립된 부분으로 그 구성 요소의 부분이다. 데이터베이스 파티셔닝 은 일반적으로로드 밸런싱과 같이 관리 효율성, 성능 또는 가용성 이유로 수행됩니다.

https://ko.wikipedia.org/wiki/Partition_ (데이터베이스)

샤딩HP ( Horizontal Partitioning) 와 같은 파티션 유형입니다.

또한이 수직 분할 은 작은 별개의 부분으로 테이블을 분할함으로써 (부사장). 정규화에는 테이블에서 열을 분할하는 것도 포함되지만 수직 분할은이 범위를 넘어 이미 정규화되어 있어도 열을 분할합니다.

https://ko.wikipedia.org/wiki/Shard_(database_architecture)

Quora에 대한 Tony Baco의 답변을 정말 좋아합니다. 열과 행이 아닌 스키마 측면에서 생각하게합니다. 그는 ...

" 수평 분할 "또는 샤딩은 스키마를 복제 [복사] 한 다음 샤드 키를 기준으로 데이터를 분할합니다.

" 수직 파티셔닝 "은 스키마를 나누는 것과 관련이 있습니다 (그리고 데이터는 데이터를 옮깁니다).

https://www.quora.com/Whats-the-difference-between-sharding-DB-tables-and-partitioning-them

Oracle Database Partitioning Guide에는 멋진 수치가 있습니다. 나는 기사의 발췌 부분을 복사했습니다.

https://docs.oracle.com/cd/B28359_01/server.111/b32024/partition.htm

테이블을 분할하는시기

다음은 테이블을 분할 할 때 권장되는 사항입니다.

  • 2GB보다 큰 테이블은 항상 파티셔닝 후보로 간주해야합니다.
  • 새 데이터가 최신 파티션에 추가되는 히스토리 데이터가 포함 된 테이블. 일반적인 예는 현재 월의 데이터 만 업데이트 할 수 있고 다른 11 개월은 읽기 전용 인 내역 테이블입니다.
  • 테이블의 내용을 다른 유형의 저장 장치에 분산시켜야하는 경우

파티션 정리

Partition pruning is the simplest and also the most substantial means to improve performance using partitioning. Partition pruning can often improve query performance by several orders of magnitude. For example, suppose an application contains an Orders table containing a historical record of orders, and that this table has been partitioned by week. A query requesting orders for a single week would only access a single partition of the Orders table. If the Orders table had 2 years of historical data, then this query would access one partition instead of 104 partitions. This query could potentially execute 100 times faster simply because of partition pruning.

Partitioning Strategies

  • Range
  • Hash
  • List

You can read their text and visualize their images which explain everything pretty well.

And lastly, it is important to understand that databases are extremely resource intensive:

  • CPU
  • Disk
  • I/O
  • Memory

Many DBA's will partition on the same machine, where the partitions will share all the resources but provide an improvement in disk and I/O by splitting up the data and/or index.

While other strategies will employ a "shared nothing" architecture where the shards will reside on separate and distinct computing units (nodes), having 100% of the CPU, disk, I/O and memory to itself. Providing it's own set of advantages and complexities.

https://en.wikipedia.org/wiki/Shared_nothing_architecture


Consider a Table in database with 1 Million rows and 100 columns In Partitioning you can divide the table into 2 or more table having property like:

  1. 0.4 Million rows(table1), 0.6 million rows(table2)

  2. 1 Million rows & 60 columns(table1) and 1 Million rows & 40 columns(table2)

    There could be multiple cases like that

This is general partitioning

But Sharding refer to 1st case only where we are dividing the data on the basis of rows. If we are dividing the table into multiple table we need to maintain multiple similar copies of schemas as now we have multiple tables.


Sharding in a special case of horizontal partitioning, when partitions spans across multiple database instances. If a database is sharded, it means that it's partitioned by definition.

참고URL : https://stackoverflow.com/questions/20771435/database-sharding-vs-partitioning

반응형