dfeinzimer / beepboopbackend

CSUF CPSC 476 Spring 2019 - Back-End Engineering
0 stars 0 forks source link

We select x random articles not x most recent articles #20

Open dfeinzimer opened 5 years ago

dfeinzimer commented 5 years ago
cqlsh:beepboopbackend> SELECT * FROM articles ORDER BY article_date DESC LIMIT 5 ;
InvalidRequest: Error from server: code=2200 [Invalid query] message="ORDER BY is only supported when the partition key is restricted by an EQ or an IN."
dfeinzimer commented 5 years ago

I believe this will require a table architecture change

dfeinzimer commented 5 years ago

make a clustering key on that column that way it orders it on its own and all you need to do is the LIMIT https://www.datastax.com/dev/blog/the-most-important-thing-to-know-in-cassandra-data-modeling-the-primary-key