複数リージョン表へのアクセスおよび操作

MR表を作成した後、既存のデータ・アクセスAPIまたはDML文を使用して、表に対する読取りまたは書込み操作を実行できます。MR表を操作するために既存のデータ・アクセスAPIまたはDML文を変更する必要はありません。SQLリファレンス・ガイドデータ行の管理を参照してください。

次に例を示します。

一方のリージョンのusers表に対してDML操作を実行し、他方のリージョンに変更がレプリケートされるかどうかを確認します。

# To be executed in the fra region
-- Insert two rows into the users MR Table
sql-> INSERT INTO users(id,name,team) VALUES(1,"Amy","HR");
{"NumRowsInserted":1}
1 row returned
sql-> INSERT INTO users(id,name,team) VALUES(2,"Jack","HR");
{"NumRowsInserted":1}
1 row returned

# To be executed in the lnd region
-- Verify if the rows are replicated from the fra region
sql-> SELECT * FROM users;
{"id":1,"name":"Amy","team":"HR"}
{"id":2,"name":"Jack","team":"HR"} 

2 rows returned

-- Update the row with id = 2 in the users MR Table
sql-> UPDATE users SET team = "IT" WHERE id = 2;
{"NumRowsUpdated":1}
1 row returned

-- Delete the row with id = 1 from the users MR Table
sql-> DELETE FROM users WHERE id = 1;
{"NumRowsDeleted":1}
1 row returned

# To be executed in the fra region
-- Verify if the changes are replicated from the lnd region
sql-> SELECT * FROM users;
{"id":2,"name":"Jack","team":"IT"} 
1 row returned