You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by web master <so...@gmail.com> on 2017/06/21 06:43:48 UTC
COUNT
I have this schema
CREATE TABLE IF NOT EXISTS "inbox" (
"groupId" BIGINT,
"createTime" TIMEUUID,
"mailId" BIGINT,
"body" TEXT,
PRIMARY KEY ("groupId","createTime","mailId")
)WITH CLUSTERING ORDER BY ("createTime" DESC);
This table is frequency updated (250K per second) and each between 10-1000
new record is inserted in each "groupId" per day
The problem is I want to count `Unread mails` that based on a TIMEUUID
compare, that means I want to count
SELECT count(1) FROM inbox WHERE "groupId"=123456 AND "createTime">
specificTimeUUID
But this query is inefficiend and slow sometimes
If we have <1000 unread message there is no problem but when we have 50K+
unread message we have huge issue
What is the best solution for the problem?
RE: COUNT
Posted by "ZAIDI, ASAD A" <az...@att.com>.
Is it possible for you to share tracing info for the query? You can enable tracing at cqlsh prompt with command
Cqlsh > TRACING ON
Cqlsh> run your query
Tracing session info should be printed on screen
Tracing will enable us to know where most of the time is spent!
From: web master [mailto:socketman2016@gmail.com]
Sent: Wednesday, June 21, 2017 1:44 AM
To: user@cassandra.apache.org
Subject: COUNT
I have this schema
CREATE TABLE IF NOT EXISTS "inbox" (
"groupId" BIGINT,
"createTime" TIMEUUID,
"mailId" BIGINT,
"body" TEXT,
PRIMARY KEY ("groupId","createTime","mailId")
)WITH CLUSTERING ORDER BY ("createTime" DESC);
This table is frequency updated (250K per second) and each between 10-1000 new record is inserted in each "groupId" per day
The problem is I want to count `Unread mails` that based on a TIMEUUID compare, that means I want to count
SELECT count(1) FROM inbox WHERE "groupId"=123456 AND "createTime"> specificTimeUUID
But this query is inefficiend and slow sometimes
If we have <1000 unread message there is no problem but when we have 50K+ unread message we have huge issue
What is the best solution for the problem?