This article has multiple issues. Please helpimprove it or discuss these issues on thetalk page.(Learn how and when to remove these messages) (Learn how and when to remove this message)
|

Akeyspace (orkey space) in aNoSQLdata store is an object that holds together allcolumn families of a design.[1][2] It is the outermost grouping of the data in the data store.[3] It resembles theschema concept inRelational database management systems.[4] Generally, there is one keyspace per application.
A keyspace may containcolumn families orsuper columns. Each super column contains one or more column families, and each column family contains at least one column. The keyspace is the highest abstraction in adistributed data store. This is fundamental in preserving the structural heuristics in dynamic data retrieval.[5] Multiple relay protocol algorithms are integrated within the simple framework.[6]
The keyspace has similar importance like aschema has in a database. In contrast to the schema, however, it does not stipulate any concrete structure, like it is known in theentity–relationship model used widely in therelational data models. For instance, the contents of the keyspace can be column families, each having different number of columns, or even different columns. So, the column families that somehow relate to therow concept in relational databases do not stipulate any fixed structure. The only point that is the same with a schema is that it also contains a number of "objects", which are tables in RDBMS systems and here column families or super columns.
So, in distributed data stores, the whole burden to handle rows that may even change from data-store update to update lies on the shoulders of the programmers.
As an example, we show a number of column families in a keyspace. TheCompareWith keyword defines how the column comparison is made. In the example, theUTF-8 standard has been selected. Other ways of comparison exist, such asAsciiType,BytesType,LongType,TimeUUIDType.
<KeyspaceName="DeliciousClone"><KeysCachedFraction>0.01</KeysCachedFraction><ColumnFamilyCompareWith="UTF8Type"Name="Users"/><ColumnFamilyCompareWith="UTF8Type"Name="Bookmarks"/><ColumnFamilyCompareWith="UTF8Type"Name="Tags"/><ColumnFamilyCompareWith="UTF8Type"Name="UserTags"/><ColumnFamilyCompareWith="UTF8Type"CompareSubcolumnsWith="TimeUUIDType"ColumnType="Super"Name="UserBookmarks"/></Keyspace>
Another example shows a simplifiedTwitter clone data model:
<KeyspaceName="TwitterClone"><KeysCachedFraction>0.01</KeysCachedFraction><ColumnFamilyCompareWith="UTF8Type"Name="Users"/><ColumnFamilyCompareWith="UTF8Type"Name="UserAudits"/><ColumnFamilyCompareWith="UTF8Type"CompareSubcolumnsWith="TimeUUIDType"ColumnType="Super"Name="UserRelationships"/><ColumnFamilyCompareWith="UTF8Type"Name="Usernames"/><ColumnFamilyCompareWith="UTF8Type"Name="Statuses"/><ColumnFamilyCompareWith="UTF8Type"Name="StatusAudits"/><ColumnFamilyCompareWith="UTF8Type"CompareSubcolumnsWith="TimeUUIDType"ColumnType="Super"Name="StatusRelationships"/></Keyspace>
Keyspaces are quite simple again, from an RDBMS point of view you can compare this to your schema, normally you have one per application. A keyspace contains the ColumnFamilies. Note, however, there is no relationship between the ColumnFamilies. They are just separate containers.
[A Keyspace] Contains multiple Column Families.
A Keyspace is the outer most grouping of your data. All your ColumnFamily's go inside a Keyspace. Your Keyspace will probably named after your application.
In Cassandra:It can be confusing, with each NoSQL database using terms differently from each other, and all of them using terms differently from RDBMS.
- A Keyspace is like a schema
- ColumnFamily is roughly like a table