Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • Kea Kea
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 563
    • Issues 563
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 68
    • Merge requests 68
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • ISC Open Source ProjectsISC Open Source Projects
  • KeaKea
  • Issues
  • #529
Closed
Open
Issue created Mar 11, 2019 by Razvan Becheriu@razvanDeveloper

Cassandra get lease page does not return sorted results without clustering column

Doing queries in the Cassandra database with '>' or '<' operands and 'LIMIT', but without 'ORDER BY' will retrieve some elements from the database, but not necessarily in order.

Values in the database table 'test':

value

9 3 7 8 2 5

query 'select value from test where value > 3 limit 2' will retrieve 9 and 7. The next query which will be run for the next page 'select value from test where value > 9 limit 2' will miss values like 8 and 5...

To be able to 'ORDER BY', a clustering column must be created. If the primary key is a compound key (partition key + clustering key), the data will be sorted on each partition. For example if creating a dummy partition key: CREATE TABLE test ( dummy int, value int, PRIMARY KEY (dummy, value));

and inserting all values with dummy = 0 will guarantee that retrieved values will be ordered, but all the data in the table will be stored on a partition.

Another implementation could retrieve all data from respective table and sort it in memory and split it by page size, but this would make the purpose of using pages useless.

Edited Mar 11, 2019 by Razvan Becheriu
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking