Database Reference
In-Depth Information
Figure 3-4 . Fetching users by first_name
Query over indexed column first_name with value 'vivek' ( Figure 3-4 ) re-
turns two rows. Here both rows can be available on the same node or different nodes.
One point worth mentioning here is that indexes would also be stored locally along
with data rows, which would ensure data locality.
On the other hand, if we try to fetch rows using column twitter_handle ,
which is non-indexed:
select * from users where twitter_handle='#imvivek';
it results in the following error:
Bad Request: No indexed columns present in by-columns
clause with Equal operator
Let's try another type of example:
1.
Add another column age :
alter table users add age int ;
2.
Update a few rows for age :
update users set age = 21 where user_id =
498d9f00-d47f-11e3-be07-79e7dcea6dd7;
update users set age = 51 where user_id =
498b06f0-d47f-11e3-be07-79e7dcea6dd7;
3.
Create an index on the age column:
create index age_idx on users(age);
4.
Now, try to fetch user_id for a user with age 21:
 
Search WWH ::




Custom Search