You are the hero who saves me for my presentation of dynamoDB at class , such a great explaination
@pravinbudage39422 жыл бұрын
You have explained it very smoothly and cleared all the doubts. Thanks
@BeABetterDev2 жыл бұрын
You're very welcome!
@yogiHalim4 жыл бұрын
great vid. Thanks. First example on 4:00 mins, first approach scan on entire table, should read all data including forum name EC2 and RDS. You stopped at S3 while not entirely wrong but mildly confusing at first as compared to second approach.
@yogiHalim4 жыл бұрын
Thanks for the code snippets 7:05 mins (just leaving a shortcut here)
@roboprofit25483 жыл бұрын
Great video. Keep in mind that more LSI more cost. AWS DOC ==> "A table with many local secondary indexes incurs higher costs for write activity than tables with fewer indexes" However, writing to the base table with 2 LSIs still cost 1 WCU IF you don't write to LSIs as well. If you write to 1 LSI then it costs 2 WCUs ( 1 for the table and 1 for LSI)
@BeABetterDev3 жыл бұрын
Great point! Thanks for sharing.
@bradw2k3 жыл бұрын
When would a write to a table not result in a write also to its GSI?
@tahiraziz1932 жыл бұрын
Hi @Robo Profit would be great if you can share any reference please? i have gone through the AWS documentation but couldn't find this. Thanks
@roboprofit25482 жыл бұрын
@@bradw2k when you don't write to the index and only write to the base table
@SpotCallerzWrestling4 жыл бұрын
This is exactly what I needed! Thanks very much. Saved me a lot of money.
@BeABetterDev4 жыл бұрын
You are very welcome!
@mugssyy2 жыл бұрын
Hi ! Your videos are great! I had trouble understanding the LSI and GSI for a long time. Thank you . going through more of your content.
@BeABetterDev2 жыл бұрын
Thanks so much Mugdha!
@prvinsharma2 жыл бұрын
Well explained! I was going through PluralSight and got lost there with LSI and GSI. Had to hop in here as the first and greatfully the last for LSI. GSI would be next. Thanks
@Sami-ec9sd4 ай бұрын
There is one limitation when using LSI: Your Data being stored within the same partition key isn't anymore allowed to exceed 10GB. If you have reached 10GB you wont be able to add more items (you get the error ItemCollectionSizeLimitExceededException). You can read about this in the aws doc with the title "Local Secondary Indexes" and the subtitle "Item collections in Local Secondary Indexes"
@aamersohail4743 жыл бұрын
Thank you so much for exemplifying it so clearly.
@BeABetterDev3 жыл бұрын
You're very welcome Aamer!
@krishnasmusicchart48972 жыл бұрын
Explained excellently, sir
@BeABetterDev2 жыл бұрын
Thank you
@gdemelo9 ай бұрын
Great explanation. I would recommend providing SDK examples with Javascript/NodeJS or Python, instead of Java, though.
@windowcrystal40124 жыл бұрын
Speed: Scan then filter < query on partition key < LSI
@BeABetterDev4 жыл бұрын
Spot on!
@TomerBenDavid4 жыл бұрын
Very clear! Last limitations section was great. I would also suggest to add what are the drawbacks when should you not use it obviously it does not come for free and you might want to use a different db like a mirror in some other place to do these queries based on your intent there is a reason it's a simple kv. Great video many thanks.
@mqtt07 Жыл бұрын
One other limitation, just to be clear, is that you can change the sort key, not the partition key in an LSI
@JesusAlfredoHernandezOrozco Жыл бұрын
Great video! Really well explained. I recommend it!
@worddoc43223 жыл бұрын
Thank you for the video. I have a question: once a sort key has been set, a table keeps its data sorted by that key. LSI is considered as an extension of the sort key. How the table gets sorted by a pack of sort key + multiple LSI? I think there is something different behind LSI. Could you shed light on it please?
@niteshgupta84362 жыл бұрын
I also have the same doubt. Please explain.
@karahisarli4 жыл бұрын
Great videos and explanation, appreciate the effort, tried couple of blogs/documents but very clearly stated here. Can you please give some tutorials on schema design specially some relations?
@BeABetterDev4 жыл бұрын
Thanks serdar. I'll look into incorporating relations in an upcoming video!
@sameeshoncloud94 жыл бұрын
amazing work buddy
@BeABetterDev4 жыл бұрын
Thank you! Cheers!
@jwalaivaturi3 жыл бұрын
Thanks for the awesome video. Queries or scans on a local secondary index consume read capacity units from the base table and updates consume write capacity units from the base table. What do you mean by no extra cost with LSI?
@Xhez2slash3 жыл бұрын
It is compared to the GSI, where if you create an another GSI for your table that would incur extra cost. (provision extra wcu/rcu for the table created)
@_arshadm2 жыл бұрын
You left one of the most important questions unanswered. Does the LSI range key attribute also need to be unique in combination with the hash key (i.e. LSI is just another sort key)
@renatolimasantos86182 жыл бұрын
From aws docs: "In a DynamoDB table, the combined partition key value and sort key value for each item must be unique. However, in a local secondary index, the sort key value does not need to be unique for a given partition key value. If there are multiple items in the local secondary index that have the same sort key value, a Query operation returns all of the items that have the same partition key value. In the response, the matching items are not returned in any particular order."
@_arshadm2 жыл бұрын
@@renatolimasantos8618 Thanks, I was looking for this additional info. This makes the LSI a lot more useful.
@Viet1003 жыл бұрын
I have a question for scan operation. if I scan by PK and Subject="aaa" for example, does dynamodb scan/read "LastPostDateTime"? or it just scan the specified column (not all columns).
@BeABetterDev3 жыл бұрын
Hi Clouder, Scans will return the entire row, so all the columns. Hope this helps.
@Viet1003 жыл бұрын
@@BeABetterDev thanks for your effort. keep it up.
@zacsonskaria4 жыл бұрын
The PartitionKey + SortKey may not be unique, since two subjects in a forum can have same LastPostDateTime. It may not be relevant since it is just an example and the focus is something else, however it can cause confusion in my opinion.
@BeABetterDev4 жыл бұрын
Hi Zacson, thanks for pointing this out. You are absolutely correct.
@pikachu52232 жыл бұрын
There you can use the suffix pattern
@rongrongmiao3018 Жыл бұрын
If you use Unix epoch time it would be unique
@zacsonskaria Жыл бұрын
@@rongrongmiao3018 Why do you think that the unix epoch time won’t collide when generated at the same time?
@xamry_4 жыл бұрын
Thanks, to the point and easy to understand.
@BeABetterDev4 жыл бұрын
Glad it was helpful!
@ankitgarg5684 жыл бұрын
Great video. Helped me a lot!!
@BeABetterDev4 жыл бұрын
Glad it helped!
@jeffinj77073 жыл бұрын
Very helpful. A quick question: I have a large JSON data, how can I create a table with that JSON structure. And can we populate the table with a JSON file?
@MohammadFaizanAli7864 жыл бұрын
It's a great video but could you explain how Amazon does it internally? How does it not create more tables and still gives such fast results? If we have local index can we choose to not provide it?
@BeABetterDev4 жыл бұрын
Hey Mohammad, Unfortunately there isn't much documentation in terms of how aws structures LSIs so really its anyone's guess.
@hejiaji2 жыл бұрын
In this example, how can the primary key be assured to be unique? ForumName(Partition key) + LastPostDateTime(SortKey) could definitely be duplicated right?
@sunwoojeong99962 жыл бұрын
Thank you for your lecture. Is LSI sth like a sort key, without having the uniqueness limitation of (partition key, sort key) pair?
@BeABetterDev2 жыл бұрын
Hi Sunwoo, that's a good way of thinking about it!
@sunwoojeong99962 жыл бұрын
@@BeABetterDev Got it. Also, for GSI, the whole table (data) is physically replicated to multiple machines. Is LSI also copying some portion of data (the data corresponding to the right partition key) and storing them in different orders?
@juancpgo4 жыл бұрын
Great content. 👍 Thank you.
@BeABetterDev4 жыл бұрын
Thanks Juan! Glad you enjoyed.
@abhishekpaithane62922 жыл бұрын
great explanation!
@ahmedal-shamari4144 жыл бұрын
thanks for your awesome Video can I ask about the brief difference between GSI and LSI? from the 2 videos I think the difference that LSI must be defined at table creation time, no Extra Cost, max 5 LSI per table, it is alternative to range key while GSI can be defined any time, need extra cost, no limitation per table, also GSI= new Partition key + new sort key am I correct with the above? thanks and best regards
@BeABetterDev4 жыл бұрын
Hi yes you are correct. Also keep in mind the purpose of the LSI and GSI are fundamentally different. LSI helps you define more range-like queries on a different index. Whereas GSI allows you to perform direct key lookups on the corresponding index.
@josecruz25744 жыл бұрын
@@BeABetterDev so if looking for a specific index - GSI would be more appropriate?
@eric194354 жыл бұрын
Nice video. What is the use case of GSI and LSI? What is the different between them?
@BeABetterDev4 жыл бұрын
Hi Eric, GSIs allow you to query for specific attributes other than the partition key. LSIs allow you to perform 'range-like' queries on your LSI's range key.
@josereneherrerauribe-ceiba80474 жыл бұрын
Hello, excellent video! You have any java repository with examples?
@BeABetterDev4 жыл бұрын
Hi Jose, I unfortunately dont but will look into setting one up. Thanks for watching.
@arhabersham3 жыл бұрын
Well explained ❤️
@BeABetterDev3 жыл бұрын
Thanks Alfredo! Glad you enjoyed :)
@ravisaraswat65194 жыл бұрын
You are great , keep up the excellent wok.
@BeABetterDev4 жыл бұрын
Thank you kindly
@ognjenaskovic18302 жыл бұрын
Hey, total newbie to Dynamo here. I have a question regarding combination of GSI and LSI. So, if my table has one GSI and one LSI defined, can I do the query which uses GSI as a hash key value and LSI as a range key value ? That would make my life a lot easier, but I'm not sure if it is possible. Will appreciate any help :)
@sardesaisantosh Жыл бұрын
how can an entire table scan will happen when you have a partition key on forumname in the example for fetching records with s3 and subject = aaa
@jeevanthomaskoshy89793 жыл бұрын
Won't LSI also duplicate the data like the global secondary index? So wouldn't that lead to increased cost ?
@sauer.voussoir3 жыл бұрын
same question, if does also create a new table copy like GSI
@alekseiborsenkodev2 жыл бұрын
Nice explanation, but I have a little correction. You CAN NOT search by endsWith. only beginwith
@angry7404 жыл бұрын
Excellent!!
@BeABetterDev4 жыл бұрын
Thank you! Cheers!
@zeretil Жыл бұрын
This is confusing to me as a rookie -- isn't your partitionkey supposed to be unique? Even when using the Sort Key as part of your partition key, there can be duplicates when two forum posts are updated at the same time?
@vagifk28644 жыл бұрын
Should LSI be unique within the same table?
@BeABetterDev4 жыл бұрын
It does not necessarily have to be.
@sonny23ization3 жыл бұрын
why is this strongly consistent?
@rickfarina98354 жыл бұрын
What is the criteria to use an LSI vs. a GSI? Or, is there now no benefit to using LSIs?
@BeABetterDev4 жыл бұрын
Hi Rick, LSIs can unfortuantely only be defined when the table is created and solve a bit of a different purpose than LSIs. LSIs allow you to perform 'range-like' queries on a data field provided you know the partition key. GSIs allow you to perform direct lookups or queries on fields other than the partition key. Hoep this helps!
@rickfarina98354 жыл бұрын
@@BeABetterDev Hi... First, thank you for this series of AWS videos. Absolutely fantastic!! On the LSI/GSI difference, it caused me to re-read the docs and do some testing. I still have the understanding that a GSI can be built over the same Partition Key (PK); and can use either the same or different Sort key (SK) than the base table, which I believe implies a range. For example: "Select PK='x' and SK between 10 and 15". I believe this represents a "Range-Query" that you mentioned above. If this is true, doesn't that mean the GSI has essentially the same Query capabilities as the LSI? If so, I'm sill not sure what benefit the LSI has over the GSI, other than it's stored along with the base table rather than creating its own Partitions as the GSI does. Thanks again, so much. Rick
@__noob__coder__ Жыл бұрын
Which coding font are you using ?
@BeABetterDev Жыл бұрын
Liberation Mono
@mhlaskar19914 жыл бұрын
Does LSI doubles the space like GSIs?
@BeABetterDev4 жыл бұрын
Hi Mahbubul, LSIs do not take extra space. Thanks for watching!
@The6thProgrammer3 жыл бұрын
@@BeABetterDev I don't believe this answer is correct. I believe similar to GSIs the LSIs will consume more space and consume WCUs as well. See here docs.aws.amazon.com/amazondynamodb/latest/developerguide/LSI.html where it is mentioned in the AWS documentation "The smaller the index, the less that it costs to store it, and the less your write costs are". This is why there is a trade-off in how many additional attributes you would want to project in your LSI.
@warrenjohnson59713 жыл бұрын
@@The6thProgrammer No more read units but more space consumed I guess?
@ralfrolfen55047 ай бұрын
perfect!
@LifeDude3 ай бұрын
Awesome
@leiliu834 жыл бұрын
So for LSI, hash key + range key does not need to be the same
@SurprisedFirzen3 жыл бұрын
partition key needs to be the same right
@adamkinsey31392 жыл бұрын
So...let's design and sell a "NoSQL" database, and then add in "fancy" features so that users can pay extra to have a fraction of the SQL features? I genuinely don't understand why you would choose to use a "NoSQL" database for any use-case like this....and I would love to know!
@BeABetterDev2 жыл бұрын
Hi Adam, Thank you for the comment. I have a video on RDS vs DynamoDB that attempts to answer your question. You can watch it here: kzbin.info/www/bejne/maOrqJihm5WaiqM Hope this helps, Daniel
@harshjain8823 Жыл бұрын
take some break when you finish a sentence.
@waytospergtherebro Жыл бұрын
This is the single most useless "database" anyone has ever designed.