1
00:00:00,120 --> 00:00:01,390
<v Instructor>So here is a new feature</v>

2
00:00:01,390 --> 00:00:03,660
of DynamoDB called Transactions.

3
00:00:03,660 --> 00:00:05,640
It's a new feature from November 2018.

4
00:00:05,640 --> 00:00:07,480
So it should appear in the exam very soon.

5
00:00:07,480 --> 00:00:09,400
And a transaction is the ability

6
00:00:09,400 --> 00:00:13,261
to create, update or delete multiple rows in multiple tables

7
00:00:13,261 --> 00:00:15,030
at the same time.

8
00:00:15,030 --> 00:00:17,900
It's very familiar to what a transaction is in RDBMS

9
00:00:17,900 --> 00:00:18,850
such as PostgreSQL.

10
00:00:19,690 --> 00:00:23,040
So it's called Transactions because it's an all or nothing

11
00:00:23,040 --> 00:00:24,310
type of operation.

12
00:00:24,310 --> 00:00:26,430
That means that, either all the things you said

13
00:00:26,430 --> 00:00:27,960
as per that transaction happen.

14
00:00:27,960 --> 00:00:29,810
Either none of them happen.

15
00:00:29,810 --> 00:00:33,150
This is the main feature of a transaction here.

16
00:00:33,150 --> 00:00:34,370
So now for the Write Modes.

17
00:00:34,370 --> 00:00:35,650
We know the Standard Write Mode,

18
00:00:35,650 --> 00:00:37,890
but now there's a new Write Mode called Transactional.

19
00:00:37,890 --> 00:00:40,220
And for the Read Mode we know Eventual Consistency,

20
00:00:40,220 --> 00:00:41,790
we know Strong Consistency,

21
00:00:41,790 --> 00:00:44,907
but now there is Transactional as a new Read Mode.

22
00:00:44,907 --> 00:00:47,040
So, for the Transactional Mode,

23
00:00:47,040 --> 00:00:51,107
it Consumes twice the WCU or RCU that you know of.

24
00:00:51,107 --> 00:00:52,947
No calculations should be expected of you.

25
00:00:52,947 --> 00:00:56,010
The only thing is, that is expected of you

26
00:00:56,010 --> 00:00:57,480
is to remember what the transaction is,

27
00:00:57,480 --> 00:00:59,230
and in which case you will use it.

28
00:00:59,230 --> 00:01:00,730
So how about we go through an example.

29
00:01:00,730 --> 00:01:02,430
And this is just a theory lecture.

30
00:01:02,430 --> 00:01:04,980
So let's say we have an Account Balance Table.

31
00:01:04,980 --> 00:01:08,240
And the Account Balance Table has the account id,

32
00:01:08,240 --> 00:01:11,140
the balance, the money the user has in their account,

33
00:01:11,140 --> 00:01:13,740
and the last transaction timestamp.

34
00:01:13,740 --> 00:01:15,520
Now so there is a Bank Transaction Tables,

35
00:01:15,520 --> 00:01:17,440
which represents the transactions

36
00:01:17,440 --> 00:01:19,120
maybe between the accounts.

37
00:01:19,120 --> 00:01:21,450
So here we can see that we have two transactions

38
00:01:21,450 --> 00:01:22,283
between these two accounts.

39
00:01:22,283 --> 00:01:24,147
And we can see the value of these transactions.

40
00:01:24,147 --> 00:01:27,070
Obviously, if I wanted update,

41
00:01:27,070 --> 00:01:29,740
and add a bank transaction to a table,

42
00:01:29,740 --> 00:01:31,960
I also want to add that to my Account Balance Table

43
00:01:31,960 --> 00:01:33,300
at the very same time.

44
00:01:33,300 --> 00:01:34,641
I don't want an update to happen

45
00:01:34,641 --> 00:01:35,880
to the Bank Transaction Tables

46
00:01:35,880 --> 00:01:37,800
and not happen to the Account Balance.

47
00:01:37,800 --> 00:01:40,360
So we need either both things to happen,

48
00:01:40,360 --> 00:01:42,540
both Writes to happen to both tables

49
00:01:42,540 --> 00:01:43,373
or none of it.

50
00:01:43,373 --> 00:01:46,330
And this is a perfect use case for transaction.

51
00:01:46,330 --> 00:01:49,773
So transaction again is a Write to both tables, or none.

52
00:01:49,773 --> 00:01:52,870
And hopefully that clarifies the concept for you.

53
00:01:52,870 --> 00:01:54,430
So it's not something you can do for the console

54
00:01:54,430 --> 00:01:55,910
but it's something you need to be know about.

55
00:01:55,910 --> 00:01:58,130
And for the exam, probably just a high level.

56
00:01:58,130 --> 00:01:59,320
So I hope that was helpful

57
00:01:59,320 --> 00:02:01,270
and I will see you in the next lecture.

