- Learning Apache Cassandra(Second Edition)
- Sandeep Yarabarla
- 182字
- 2021-07-03 00:19:31
Partial inserts
You are not, of course, required to provide values for all columns—other than primary key columns—when inserting a row. If, for instance, we decide to allow users to register without providing an email, we may issue this perfectly valid query:
INSERT INTO "users"
("username", "encrypted_password")
VALUES (
'bob',
0x10920941a69549d33aaee6116ed1f47e19b8e713
);
In the preceding query, we only insert values for the username and encrypted_password fields; the row will have no value in the email field.
Do empty columns take up space?
Only columns with values take up storage space in Cassandra. This is in contrast to relational databases, in which every row has space allocated for every column, whether or not that column has a value. So, there's little downside to defining columns in Cassandra that you expect to rarely populate; they'll only take up space where they have values. For a full reference on the INSERT statement in CQL, consult the DataStax CQL documentation at http://www.datastax.com/documentation/cql/3.1/cql/cql_reference/insert_r.html.
We haven't explored all of the possibilities for INSERT statements yet, but we'll cover many of them in future chapters.
- 集成架構(gòu)中型系統(tǒng)
- 21天學通JavaScript
- ROS機器人編程與SLAM算法解析指南
- 數(shù)據(jù)挖掘方法及天體光譜挖掘技術(shù)
- Implementing Oracle API Platform Cloud Service
- 大數(shù)據(jù)時代
- Python:Data Analytics and Visualization
- 網(wǎng)絡(luò)服務(wù)搭建、配置與管理大全(Linux版)
- 格蠹匯編
- Pentaho Analytics for MongoDB
- 機器人人工智能
- Apache源代碼全景分析(第1卷):體系結(jié)構(gòu)與核心模塊
- 智能制造系統(tǒng)及關(guān)鍵使能技術(shù)
- JSP通用范例開發(fā)金典
- Photoshop CS4圖像處理考前12小時