Nosql> couchdb> technical overview (technical overview)

Source: Internet
Author: User
Tags couchdb

Based on version 1.2

Document Storage

If the table is the storage unit of SQL Server, the documents are the storage unit of couchdb. Each document has a unique ID. Developers can add, query, modify, and delete documents based on the restful http api provided by couchdb.

Columns in the SQL Server table, that is, fields, including int, String, text, Boolean, and Other types. The document fields in couchdb also have types. The types are strings. The document in couchdb has no limit on the number of fields and the size of fields.

Couchdb has no lock mechanism. The process of modifying a document is to read, modify, and return to the document. If you read the document and are modifying the document, and others have modified the same document as before, your modifications will overwrite others' modifications.

The document is either modified successfully or failed, but some fields are not modified successfully.

 

ACID properties

The couchdb file layout and commitment system features all atomic consistent isolated durable (acid) properties. on-disk, couchdb never overwrites committed data or associated structures, ensuring the database file is always in a consistent state. this is a "crash-only" design where the couchdb server does not go through a shut down process, it's simply terminated.

What is atomicity, consistency, isolation, and durability. Couchdb does not overwrite the data you submit. This design ensures that couchdb will not suddenly take it as its own. This will not cause read/write conflicts.

 

Document updates (add, edit, delete) are serialized, whose t for Binary blobs which are written concurrently. database readers are never locked out and never have to wait on writers or other readers. any number of clients can be reading documents without being locked out or interrupted by concurrent updates, even on the same document. couchdb read operations use a multi-version concurrency control (MVCC) model where each client sees a consistent snapshot of the database from the beginning to the end of the read operation.

Couchdb does not have a query lock, that is, even if couchdb is writing a document, updating the document, or others are querying the document, you can also query the couchdb document. Because couchdb uses the multi-version Synchronization Control Model MVCC to ensure that the documents queried by each client are consistent.

 

Parameters are indexed in B-trees by their name (docid) and a sequence ID. each update to a database instance generates a new sequential number. sequence IDs are used later for Incrementally finding changes in a database. these B-tree indexes are updated simultaneously when documents are saved or deleted. the index updates always occur at the end of the file (append-only updates ).

The couchdb document index uses the B-tree algorithm. Every time you update couchdb, a number is generated. You can find the database changes based on the number. When you save or delete a document, the document index is updated.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.