I think there is just a few solutions.

- Secondary index on username
- CF used as an index (store username as row and all the uuid of users with this username as columns)
- Get all the data and filter after (really poor performances depending on the size of the data set)

I can't see an other way to perform your query.


2012/11/9 Alan Ristić <alan.ristic@gmail.com>
Here is the thing. I'm modelling User entity and got to problem with searching trough user columns.

CREATE TABLE users (
  user_uuid uuid PRIMARY KEY,
  date_created timestamp,
  password varchar,
  username varchar,          
  name varchar,
  first_name varchar,
  last_name varchar,
  email varchar,
  ...
) ;

CREATE INDEX users__username_idx ON users (username); 

Now I know it's a bad practice to model sec. index on 'username' becouse of uniqness and all but what's the alternative? I'd want 'username' to be "searchable"?

Tnx,
Alan Ristić

m: 040 423 688