Home Database Mysql Tutorial Cassandra 数据模型 (基于CQL,解决胖列数量限制及灵活性问题)

Cassandra 数据模型 (基于CQL,解决胖列数量限制及灵活性问题)

Jun 07, 2016 pm 05:38 PM
cassandra based on data quantity Model solve limit

Cassandra 数据模型 (基于CQL,解决胖列数量限制及灵活性问题)(1.1及以上版本) 文中主要交代Cassandra的编程模型及数据结构。由于Cassandra版本数次更新,网上中文的资料已经有点过时,比较有代表性的比如ebuy那篇文章都已经过时了,于是自己找资料,结合

Cassandra 数据模型 (基于CQL,解决胖列数量限制及灵活性问题)(1.1及以上版本)

文中主要交代Cassandra的编程模型及数据结构。 由于Cassandra版本数次更新,网上中文的资料已经有点过时,比较有代表性的比如ebuy那篇文章都已经过时了,于是自己找资料,结合官方博客写一篇Cassandra模型的文章。 一些名词的介绍:由于技术名词冲突,BigTable里的表对应的是Cassandra里的列族,而BigTable里面列族的概念更类似Cassandra早期实现里的超级列(该功能在Cassandra里已被关闭)。 Cassandra介绍 首先介绍一下Cassandra。 Cassandra是Apache的开源项目,是NoSQL的一种,广泛意义上的列族数据库,分布式,无中心机。其早期实现主要参考了Google的Big Table论文及亚马逊的Dynamo论文中的介绍,可以参考两篇论文来获得Cassandra的设计思想,关于更详细的资料,可以参见wiki及官方文档。 早期实现及最佳实践 前文提到早期实现,那么现在当然与早期区别已经极大了,从数据模型设计到实际使用,基本上已经自成体系了。其中之一最大的改变,就是1.1版本里对数据库操作的改变。 Cassandra的早期实现里,使用的完全是BigTable的数据模型,即列及列族及主键等概念。在ebuy的最佳实践的文中,对该模型的使用做了详细解释,我无意在此引用他人文章,只是简单说一下概念。 最佳实践文章总共分两部分,上部分主要说的是列族数据库中该如何设计数据模型,其中主要讨论的是对关系及部分相关数据的重复储存来减少对数据库的分布式读取,其中对列族数据库数据结构的有个挺有意思的式子,如下: Map> 下部分交代的则是Cassandra中的具体实现方式,比如当时Cassandra实现了一个与BigTable列族类似的东西,或者说只是名字不同的东西,就是超级列,把类似的列聚 合在一起提取。

NewImage

再比如说推荐使用胖列(使用列键查询)而不是瘦列(使用主键查询)。胖列指的是以大量的列储存关系,比如用户表users有三列user_k,p1,p2,第一列user_k是主键,第二列p1是用户购买的产品1,第三列p2是用户购买的产品2,pn可以扩展到极大的数量. 注:上文只是简单解释,实际全文中对各种应用场景的讨论不仅限于该范围。 磁盘储存方式 Cassandra使用的方式是:把一级主键当做分区主键,列名作为列键储存。光说不清楚,上图:(图片来自Cassandra 1.1) CREATE TABLE timeline ( user_id varchar, tweet_id uuid, author varchar, body varchar, PRIMARY KEY (user_id, tweet_id) );

NewImage

上图是传统数据库的储存方式。

NewImage

上图是Cassandra的储存方式,注意{1787,author}是列键名而不只是数据。 现在的实现 随着Cassandra的成长,原先完全按照BigTable实现的数据模型开始产生一些问题,其中之一就是无法无限扩大的列的数量,虽然已经设计了一个足够大的列数量,但对于大数据分布式数据库,仍然是不够用的,,而且超级列的方式灵活性受限制,于是开发者开始走自己的道路,于是随着CQL(Cassandra自己的类似SQL的操作语言)的发布及发展,首先清除了超级列(BigTable里的列族)的概念:在CQL中,没有超级列的概念,在列上一级就是表,也就是原先概念上的超级列是不存在的,那针对原先的胖列的应用场景,该如何处理呢? CQL中有主键及二级主键的概念,主键就是原先的主键,这个概念没有变化,而对于原先的超级列聚合,CQL通过把二级主键的值加上列名作为列键名解决了这个问题。 也就是说,把原先由数据字典(请允许我使用这个关系数据库词汇)储存的数据储存到了数据表中,减轻了对数据字典的访问及数据字典数据结构的维持开销,把压力下发到数据表。 参考: Schema in Cassandra 1.1 Cassandra Wiki Cassandra Data Modeling Best Practices, Part 1 Cassandra Data Modeling Best Practices, Part 2

posted on

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo May 07, 2024 pm 04:13 PM

Imagine an artificial intelligence model that not only has the ability to surpass traditional computing, but also achieves more efficient performance at a lower cost. This is not science fiction, DeepSeek-V2[1], the world’s most powerful open source MoE model is here. DeepSeek-V2 is a powerful mixture of experts (MoE) language model with the characteristics of economical training and efficient inference. It consists of 236B parameters, 21B of which are used to activate each marker. Compared with DeepSeek67B, DeepSeek-V2 has stronger performance, while saving 42.5% of training costs, reducing KV cache by 93.3%, and increasing the maximum generation throughput to 5.76 times. DeepSeek is a company exploring general artificial intelligence

KAN, which replaces MLP, has been extended to convolution by open source projects KAN, which replaces MLP, has been extended to convolution by open source projects Jun 01, 2024 pm 10:03 PM

Earlier this month, researchers from MIT and other institutions proposed a very promising alternative to MLP - KAN. KAN outperforms MLP in terms of accuracy and interpretability. And it can outperform MLP running with a larger number of parameters with a very small number of parameters. For example, the authors stated that they used KAN to reproduce DeepMind's results with a smaller network and a higher degree of automation. Specifically, DeepMind's MLP has about 300,000 parameters, while KAN only has about 200 parameters. KAN has a strong mathematical foundation like MLP. MLP is based on the universal approximation theorem, while KAN is based on the Kolmogorov-Arnold representation theorem. As shown in the figure below, KAN has

Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Apr 18, 2024 pm 07:58 PM

Boston Dynamics Atlas officially enters the era of electric robots! Yesterday, the hydraulic Atlas just "tearfully" withdrew from the stage of history. Today, Boston Dynamics announced that the electric Atlas is on the job. It seems that in the field of commercial humanoid robots, Boston Dynamics is determined to compete with Tesla. After the new video was released, it had already been viewed by more than one million people in just ten hours. The old people leave and new roles appear. This is a historical necessity. There is no doubt that this year is the explosive year of humanoid robots. Netizens commented: The advancement of robots has made this year's opening ceremony look like a human, and the degree of freedom is far greater than that of humans. But is this really not a horror movie? At the beginning of the video, Atlas is lying calmly on the ground, seemingly on his back. What follows is jaw-dropping

Slow Cellular Data Internet Speeds on iPhone: Fixes Slow Cellular Data Internet Speeds on iPhone: Fixes May 03, 2024 pm 09:01 PM

Facing lag, slow mobile data connection on iPhone? Typically, the strength of cellular internet on your phone depends on several factors such as region, cellular network type, roaming type, etc. There are some things you can do to get a faster, more reliable cellular Internet connection. Fix 1 – Force Restart iPhone Sometimes, force restarting your device just resets a lot of things, including the cellular connection. Step 1 – Just press the volume up key once and release. Next, press the Volume Down key and release it again. Step 2 – The next part of the process is to hold the button on the right side. Let the iPhone finish restarting. Enable cellular data and check network speed. Check again Fix 2 – Change data mode While 5G offers better network speeds, it works better when the signal is weaker

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

FisheyeDetNet: the first target detection algorithm based on fisheye camera FisheyeDetNet: the first target detection algorithm based on fisheye camera Apr 26, 2024 am 11:37 AM

Target detection is a relatively mature problem in autonomous driving systems, among which pedestrian detection is one of the earliest algorithms to be deployed. Very comprehensive research has been carried out in most papers. However, distance perception using fisheye cameras for surround view is relatively less studied. Due to large radial distortion, standard bounding box representation is difficult to implement in fisheye cameras. To alleviate the above description, we explore extended bounding box, ellipse, and general polygon designs into polar/angular representations and define an instance segmentation mIOU metric to analyze these representations. The proposed model fisheyeDetNet with polygonal shape outperforms other models and simultaneously achieves 49.5% mAP on the Valeo fisheye camera dataset for autonomous driving

The latest from Oxford University! Mickey: 2D image matching in 3D SOTA! (CVPR\'24) The latest from Oxford University! Mickey: 2D image matching in 3D SOTA! (CVPR\'24) Apr 23, 2024 pm 01:20 PM

Project link written in front: https://nianticlabs.github.io/mickey/ Given two pictures, the camera pose between them can be estimated by establishing the correspondence between the pictures. Typically, these correspondences are 2D to 2D, and our estimated poses are scale-indeterminate. Some applications, such as instant augmented reality anytime, anywhere, require pose estimation of scale metrics, so they rely on external depth estimators to recover scale. This paper proposes MicKey, a keypoint matching process capable of predicting metric correspondences in 3D camera space. By learning 3D coordinate matching across images, we are able to infer metric relative

The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks The vitality of super intelligence awakens! But with the arrival of self-updating AI, mothers no longer have to worry about data bottlenecks Apr 29, 2024 pm 06:55 PM

I cry to death. The world is madly building big models. The data on the Internet is not enough. It is not enough at all. The training model looks like "The Hunger Games", and AI researchers around the world are worrying about how to feed these data voracious eaters. This problem is particularly prominent in multi-modal tasks. At a time when nothing could be done, a start-up team from the Department of Renmin University of China used its own new model to become the first in China to make "model-generated data feed itself" a reality. Moreover, it is a two-pronged approach on the understanding side and the generation side. Both sides can generate high-quality, multi-modal new data and provide data feedback to the model itself. What is a model? Awaker 1.0, a large multi-modal model that just appeared on the Zhongguancun Forum. Who is the team? Sophon engine. Founded by Gao Yizhao, a doctoral student at Renmin University’s Hillhouse School of Artificial Intelligence.

See all articles