> CREATE TABLE Country ( 
> country_id INT(10), 
> country_name CHAR(30), 
> Continent  CHAR(30),
> PRIMARY KEY (country_id)
> ) WITH "template=partitioned, backups=1"; 
> 
> 
> CREATE TABLE City ( 
> city_id INT(15),
> country_name CHAR(30), 
> city_name CHAR(50), 
> Dist CHAR(20), 
> PRIMARY KEY (city_id,country_name) 
> ) WITH "template=partitioned, backups=1, affinityKey=country_name"; 

This isn’t going to do what you’re expecting. You’re saying distribute the 
countries using the county_id and the city using he country name. You’re not 
co-locating the cities and the countries. You may need to enable non-colocated 
joins to make it work, or City needs to have country_id as part of its key.

Regards,
Stephen

Reply via email to