Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8122235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:46:07+00:00 2026-06-06T05:46:07+00:00

i have a column family use counter as create table command below: (KEY i

  • 0

i have a column family use counter as create table command below: (KEY i use bigin to filter when query ).

CREATE TABLE BannerCount (
KEY bigint PRIMARY KEY
) WITH
comment='' AND
comparator=text AND
read_repair_chance=0.100000 AND
gc_grace_seconds=864000 AND
default_validation=counter AND
min_compaction_threshold=4 AND
max_compaction_threshold=32 AND
replicate_on_write='true' AND
compaction_strategy_class='SizeTieredCompactionStrategy' AND
compression_parameters:sstable_compression='SnappyCompressor';

But when i insert data to this column family , and select using Where command to filter data
results i retrived very strange 🙁 like that:

use Query:

select count(1) From BannerCount where KEY > -1

count
-------
71

use Query:

select count(1) From BannerCount where KEY > 0;
count
-------
3

use Query:

select count(1) From BannerCount ;
count
-------
122

What happen with my query , who any tell me why i get that 🙁 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:46:09+00:00Added an answer on June 6, 2026 at 5:46 am

    To understand the reason for this, you should understand Cassandra’s data model. You’re probably using RandomPartitioner here, so each of these KEY values in your table are being hashed to token values, so they get stored in a distributed way around your ring.

    So finding all rows whose key has a higher value than X isn’t the sort of query Cassandra is optimized for. You should probably be keying your rows on some other value, and then using either wide rows for your bigint values (since columns are sorted) or put them in a second column, and create an index on it.

    To explain in a little more detail why your results seem strange: CQL 2 implicitly turns “KEY >= X” into “token(KEY) >= token(X)“, so that a querier can iterate through all the rows in a somewhat-efficient way. So really, you’re finding all the rows whose hash is greater than the hash of X. See CASSANDRA-3771 for how that confusion is being resolved in CQL 3. That said, the proper fix for you is to structure your data according to the queries you expect to be running on it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been using cassandra-cli and have been trying to create a column family with
In Cassandra, I have the following Column Family: <ColumnFamily CompareWith=TimeUUIDType Name=Posts/> I'm trying to
In database table I have column called options . It has type of integer
I have table called Buttons. Buttons table i have column button_number . Table contain
I have a column family where column names are timestamps. I need to retrieve
Here's a sample of the scenario I'm facing. Say I have this column family:
I have a sql table which has 7 column and the first six column
I use prepareStatement() when the id is a key of my SQL table and
I Have Cassandra Column Family Name as Data3, In That I Have 2 Columns
I have a simple column family 'Users' System.out.println( read User); long timestamp = System.currentTimeMillis();

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.