Allowing filtering
Cassandra, by default, only allows those queries which don't require any server-side filtering. Cassandra does this to avoid performance hits that might be caused due to these queries. Let's take the example of the employee
table, which stores employee salary details department-wise:
CREATE TABLE employee ( emp_id text PRIMARY KEY, first_name text, last_name text, department text, salary int ) CREATE INDEX emp_salary ON employee(salary) CREATE INDEX emp_department ON employee(department)
Now, if you want to get the details of all the employees in the sales department with a salary of more than 100000, you might want to run a query as follows:
SELECT first_name, last_nameFROM employee WHERE department = 'sales' AND salary > 100000 //Won't be allowed by cassandra
But this query will not be allowed by Cassandra as, in this case, even if there are very few employees who match this criterion, Cassandra will have to filter each row of the sales department to check if it's greater...