I have a table, I perform a query, and I want it to return it ordered, but it returns an unordered result.
I have the next Table:
CREATE TABLE videogames_by_release(
game_title VARCHAR,
id_game UUID,
descripcion VARCHAR,
min_age INT,
genderSET <VARCHAR>,
release_date DATE,
release_month VARCHAR,
PRIMARY KEY ( release_month , release_date , min_age , game_title )
)WITH CLUSTERING ORDER BY (release_date ASC, min_age ASC, game_title DESC);
The question is: Return the data of all video games with a minimum user age greater than or equal to 18 years.
And I made the next Query:
SELECT * FROM videogames_by_release WHERE min_age >=18 ALLOW FILTERING;
But I get an unordered result. Why?
The result is the image below:
Why start with Junio instead of Abril?
Yes,
ALLOW FILTERINGshould never really be used. It maybe okay to use it in combination with the partition key(s) for example,in which case, it will only search within the partition key, but if you use it in the way you are using, it will do an entire scan of the table across all the partition and across all of the nodes within the cluster, which is a bad practice.
Bonus: You could start learning C* data modeling using this free browser-based tutorial to learn the nuances.