讲故事的变量与次级指数是否会降低卡桑德拉的性能?
我想建立一个系统,以报告在具有反变量的活动期间参加课程的人数。主要键是事件ID,辅助键将是舞台的名称。 以科技公司的领域为例。
CREATE TABLE event (
event_id text,
stand text,
nb counter,
PRIMARY KEY(event_id, stand)
)
INSERT INTO event(event_id, stand, nb) VALUES (2, "appel", 0);
INSERT INTO event(event_id, stand, nb) VALUES (2, "google", 0);
INSERT INTO event(event_id, stand, nb) VALUES (2, "amazon", 0);
我的问题是,在Cassandra文档中,建议将尽可能少的索引放在柜台表上。最好的是创建一个带有两个索引的单个表或为每种类型的Stand创建一个表(这将不需要更多命令来恢复信息)
CREATE TABLE stand_name (
event_id text,
nb counter,
PRIMARY KEY (event_id)
)
INSERT INTO google(event_id, nb) VALUES (2, "appel", 0);
INSERT INTO amazon(event_id, nb) VALUES (2, "google", 0);
INSERT INTO apple(event_id, nb) VALUES (2, "amazon", 0);
I would like to make a system to report the number of people who went to a course during an event with a counter variable. The primary key would be the event id and the secondary key would be the name of the stage.
Take, for example, an area where there are tech companies.
CREATE TABLE event (
event_id text,
stand text,
nb counter,
PRIMARY KEY(event_id, stand)
)
INSERT INTO event(event_id, stand, nb) VALUES (2, "appel", 0);
INSERT INTO event(event_id, stand, nb) VALUES (2, "google", 0);
INSERT INTO event(event_id, stand, nb) VALUES (2, "amazon", 0);
My problem is that in the cassandra documentation it is advised to put as few indexes as possible on the counter tables. The best is to create a single table with two indexes or to create a table for each type of stande (which will not require more command to recover the information)
CREATE TABLE stand_name (
event_id text,
nb counter,
PRIMARY KEY (event_id)
)
INSERT INTO google(event_id, nb) VALUES (2, "appel", 0);
INSERT INTO amazon(event_id, nb) VALUES (2, "google", 0);
INSERT INTO apple(event_id, nb) VALUES (2, "amazon", 0);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我必须承认,我对您的问题感到困惑,并且不太了解索引如何发挥作用。
使用柜台表,您只能拥有:
要检索计数器值,您必须提供主键:
在表上创建辅助索引没有任何好处,因为确实存在ISN任何要索引的东西 - 除计数器本身以外,没有其他列存储在柜台表中。干杯!
I have to admit that I'm confused by your question and don't quite understand how indexing comes into play.
With counter tables, you can only have:
To retrieve the counter value, you must provide the primary key:
There is no benefit in creating secondary indexes on the table because there really isn't anything to index -- there are no other columns stored in a counter table other than the counter itself. Cheers!