Hello guys,

In this presentation the slides 23 and 24 shows a modeling technique in
Cassandra as follows:

Link: http://pt.slideshare.net/patrickmcfadin/become-a-super-modeler

- Car table has a primary key composed of fields make, model, color,
vehicle_id.

- The partition key consists of fields make, model, color.

*Then populates the table this way:*

insert into car (make, model, color, vehicle_id)
values ('Ford','Mustang','Blue',1234);

insert into car (make, model, color, vehicle_id)
values ('Ford','','Blue',1234);

insert into car (make, model, color, vehicle_id)
values ('Ford','Mustang','',1234);

insert into car (make, model, color, vehicle_id)
values ('','Mustang','Blue',1234);

insert into car (make, model, color, vehicle_id)
values ('','Mustang','',1234);

insert into car (make, model, color, vehicle_id)
values ('','','Blue',1234);


*Finally do queries like:*

select vehicle_id from car where make='Ford' and model='' and color='Blue';

select vehicle_id from car where make='' and model='' and color='Blue';


*Another way to make the queries above would create a table by research
field, something like:*

select * from car_by_make where make='Ford';

select * from car_by_color where color='Blue';


*In the example of presentation, queries are just to get vehicle_id column.
If necessary get all columns could do something like:*

insert into car (make_key, model_key, color_key, vehicle_id, make_value,
model_value, color_value)
values ('Ford','','',1234, 'Ford', 'Mustang', 'Blue');

select vehicle_id, make_value, model_value, color_value from car where
make_key='Ford' and model_key='' and color_key='';


   1. It can be said that these 3 strategies are plausible?
   2. Is there any to be considered best practice than the other?
   3. Is there any should I NOT use at all?
   4. What are the advantages and disadvantages of each?

-- 
Atenciosamente,

Marlon Patrick

Reply via email to