DynamoDB Scan vs Query - The Things You Need To Know

Поделиться
HTML-код
  • Опубликовано: 16 дек 2024

Комментарии • 31

  • @ralfrolfen5504
    @ralfrolfen5504 2 года назад +8

    Really good content! Well presented! No annoying background music. No annoying intro to the channel. No "Hey what's up guys". No strange accent; Just good, plain English.

  • @srb1855
    @srb1855 3 года назад +1

    Excellent video! The release of your video is fortuitous - I am studying for my first AWS certification and just completed a dynamoDB lab the other night. However none of these subtleties you described were highlighted. Thanks for providing your insights. 👍

  • @__hazelnut
    @__hazelnut 3 месяца назад +1

    Good video, but I don’t quite understand how query lookup is O(1). How is that possible if we are searching the table for the matches to our query? Isn’t it based on the size of our table, so O(n) or larger?

    • @ninjoetsu
      @ninjoetsu Месяц назад +1

      It's because the database is sharded based on the partition key, so the data is grouped into partitions that are indexed by the partition keys. This means it's an O(1) hash lookup to get to the start of the partition. Also within a single partition items are indexed by the sort key, so if you also have that in your query it will be another O(1) lookup on top of the first. If you just have the partition key it will be O(partition size), which is probably still a lot smaller than your table size

  • @fafapw
    @fafapw 2 года назад +2

    Great video, dude! In my case, I'm using PK , but I have others 3 GSIs. The behavior is the same using GSI and his sort key comparing with PK + his sort key?
    thanks in advance!

    • @BeABetterDev
      @BeABetterDev  2 года назад +2

      Hi Fabricio! The Sort key logic applies the same way to GSIs as it does to PKs. Hope this clarifies!

  • @mumtazirteqaahmed8553
    @mumtazirteqaahmed8553 2 года назад

    Great explanation! On Point!

  • @jesusesquivelroman7524
    @jesusesquivelroman7524 2 года назад

    Very nice video! Very educational. What if in my Customer Order table I have other fields like "Country" and "Product Type" and I want to filter, for example, "Tech" products bought in the "US". How will I query or fetch that data?

  • @moneeshkumar1838
    @moneeshkumar1838 2 года назад +1

    Is it possible to parallel query operation? Just like parallel scan operation

    • @BeABetterDev
      @BeABetterDev  2 года назад +1

      Hi Moneesh,
      I don't know of any built-in method to do this beyond using multiple threads and firing off separate queries. There's a good article on this topic by AWS here: aws.amazon.com/blogs/database/use-parallelism-to-optimize-querying-large-amounts-of-data-in-amazon-dynamodb/
      Hope this helps

    • @moneeshkumar1838
      @moneeshkumar1838 2 года назад

      @@BeABetterDev Thanks Man
      Appreciated

  • @jonathanduran2921
    @jonathanduran2921 Год назад

    Can you do operations like give me all customers with id greater than 1 on the partition key? Or are you limited to one value for the partition key for each query?

  • @pablogonzalezrobles4429
    @pablogonzalezrobles4429 3 года назад +2

    Nice video. Question: How should be format the datetime for using query with between? dd:mm:yyyy hh:mm:ss? Or do we need to separate date and time? Any suggestions about querying dt columns.

    • @adds-kz3oc
      @adds-kz3oc 3 года назад

      Personally, I convert DateTimes to Unix timestamps. 28:10:2021 20:00:00 => 1635447600. You can then query for values less than, greater than, or between the dates.

  • @karimfayed3050
    @karimfayed3050 2 года назад

    Great Video! But what if I want to return a list with all my primary keys which method should I use and how to use it?

    • @albintsafack1232
      @albintsafack1232 4 месяца назад

      Hi ! please did you find the answer of this question ? I'm also asking me this question

  • @tiagosantos680
    @tiagosantos680 3 года назад

    Super well done video

  • @hetalraval3928
    @hetalraval3928 2 года назад

    In my case i want to scan all data each time to compare with my response to know where update occur or insert and according to that i want to perform other requests...so what could be the best possible way?

    • @fadichamieh
      @fadichamieh 2 года назад

      put a modified/created timestamp in your data, and filter based on that

  • @kerisnarendra
    @kerisnarendra 3 года назад

    Is it additional cost when querying on GSI?

  • @BullishBuddy
    @BullishBuddy 3 года назад

    Wonderful video!!

  • @DuyLe-gq6cu
    @DuyLe-gq6cu 3 года назад +1

    I use query to get data, but it also limit 1mb data like you explain scan.

  • @vimalpatel44
    @vimalpatel44 Год назад

    are RangeKey and sortkey same?

  • @hoddybhaba6704
    @hoddybhaba6704 2 года назад +1

    impeccable!!!

  • @unemployedcse3514
    @unemployedcse3514 27 дней назад

    awesome ❤

  • @naga_sai
    @naga_sai Год назад

    Do we need to Partition key all the times while querying (When I want to filter based on other normal keys)?

  • @rickharold7884
    @rickharold7884 3 года назад +1

    Cool.

  • @zagamendes2438
    @zagamendes2438 2 года назад

    You said when using query I need to know my pk, but what if I just want to list my data? Eg to do list, Will I have to use scan?