Database Reference
In-Depth Information
these coins to purchase things in the game. When you buy something, a purchase record is
added with
balance_coins
as the static column. However, one might argue to use
counter, which makes sense. Another example could be a static
Set<text>
to keep a set
of ever changing tags of a product of a category available to all the products. For more ra-
tionale on static type, you can review the Jira ticket for this feature at
ht-
Table properties
Table or column family is the center of the Cassandra universe. CQL3 provides you with
options to tweak things to meet your requirements—both performance and functional,
both. Here's a list of attributes that you set as your table properties.
As discussed in
Chapter 2
,
Cassandra Architecture
, the bloom filter is an in memory data
structure to test whether the requested row exists in an SSTable before making a disk
seek. It's a neat idea to avoid hitting disk read and hence reduces latency. The bloom filter
is a probabilistic data structure and it may return a false positive result when asked. That
means, when you ask a bloom filter if the SSTable it is associated with has a row it may
say yes, while the SSTable does not have the row. But if it says no, the SSTable definitely
does not have the row. You can configure the probability of getting the false positive res-
ult by setting
bloom_filter_fp_chance
. The tradeoff is that the lower the value of
false-positive probability, the higher the amount of memory the bloom filter will consume.
So, you can set
bloom_filter_fp_chance
to
0
for no false positive result, which
will result in the largest bloom filter array for the table.
On the other hand, you can set it to
1
, to say you want all false positive results, basically
disabling the bloom filter. In practice, you would not want any of those extreme cases.
The recommended and default value is
0.01
(if you choose
LeveledCompac-
tionStrategy
, the default value get set to
0.1
). Ideally, you wouldn't touch this con-
figuration unless you are really concerned about 10 percent reads that might be hitting the
disk. Let's take a look at the following example:
CREATE TABLE tiny_tiny_table (
tab_id uuid,
tab_details text,
PRIMARY KEY (tab_id)
) WITH bloom_filter_fp_chance = 0.001;