You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by joseheitor <jo...@heitorprojects.com> on 2018/11/20 17:32:52 UTC

SQL Affinity colocation

I have 2 tables with the following primary/foreign key mapping
(transactions.id <-> records.trans_id):

*CREATE TABLE public.transactions (
  id INT PRIMARY KEY, 
  basket VARCHAR
)
WITH "TEMPLATE=PARTITIONED";

CREATE TABLE public.records (
  id INT, 
  trans_id INT,
  last_name VARCHAR,
  email VARCHAR,
  trans_date VARCHAR,
  amount INT,
  PRIMARY KEY (id, trans_id)
)
WITH "TEMPLATE=PARTITIONED, AFFINITY_KEY=trans_id";*

Notes:
- the transactions.basket column contains a full JSON document representing
a transaction
- the records table contains records of selected fields from the
corresponding transactions.basket document

I am assuming that the above table definitions will ensure that all the
records with the same trans_id will be located on the same node?

But will the corresponding transaction also be located on the same node? Or
is there something else that I need to define?

Thanks,
Jose



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: SQL Affinity colocation

Posted by "Maxim.Pudov" <pu...@gmail.com>.
Hi Jose,
Seems right to me. 






--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/