Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Data modeling with
Amazon DynamoDB
Al...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Agenda
What is DynamoDB?
Key concepts...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Alex DeBrie
Engineering Manager, Serv...
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
What is DynamoDB?
NoSQL database
Full...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hyperscale
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Hyperephemeral compute
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Concepts
• Table
• Item
• Primary ke...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Table
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Item
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Primarykey
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Attributes
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Primary key
• Simple primary key (pa...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Simple primarykey
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Composite primarykey
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API actions
• Item-based actions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Item-based actions – Writing, updatin...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Item-based actions – Writing, updatin...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API actions
• Item-based actions
• Q...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Query
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Query
Must
provide
partition
key
May
...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
API actions
• Item-based actions
• Q...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Scan
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Scan
Avoid!
Expensive at
scale
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Secondary indexes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Secondaryindexes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Secondaryindexes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Secondaryindexes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Secondaryindexes
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Basics
1. Start with an ERD
2. Defin...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Forget your relational experience
• ...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Setup
• Ecommerce store
• Users make...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
1. Create your ERD
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Ecommerce store
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
2. Define your access patterns
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Identify access patterns
1. Get user...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
3. Design your primary keys & seconda...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Denormalization + document types
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
One-to-many: Sort keys
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Query:
“PK = USER#alexdebrie AND BEGI...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
One-to-many: Sort keys
“PK = USER#ale...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Entities
PK SK
User USER#<username> #...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Inverted index
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Inverted index
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Inverted index
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
One-to-many relationship patterns
1....
S U M M I T
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering
SELECT * FROM ORDERS
WHERE ...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Query
Must
provide
partition
key
May
...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filter expressions
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering access patterns
1. Get orde...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering access patterns
1. Get orde...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering access patterns
1. Get orde...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering access patterns
“PK = USER#...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering patterns: primary key
“PK =...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie
Filtering access pattern
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie
Filtering access pattern
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie
Filtering access pattern
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie
Filtering patterns: comp...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering patterns: Composite sort ke...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filtering patterns: Composite sort ke...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering access patterns
1. Get ord...
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filteringaccess patterns: Sparse index
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filteringaccess patterns: Sparse index
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Filteringaccess patterns: Sparse index
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Filtering patterns
1. Primary key
2....
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Thank you!
S U M M I T © 2019, Amazon...
Próxima SlideShare
Cargando en…5
×

Data modeling with Amazon DynamoDB - ADB301 - New York AWS Summit

1.795 visualizaciones

Publicado el

Amazon DynamoDB is a fully managed NoSQL database that provides fast, consistent performance as it scales. Modeling your data in the DynamoDB database structure requires a different approach from modeling in traditional relational databases. In this session, we review the key principles for modeling your DynamoDB tables and also teach you some practical patterns to use in your data models.

  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí
  • DOWNLOAD FULL BOOKS, INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF EBOOK here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc Ebook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Responder 
    ¿Estás seguro?    No
    Tu mensaje aparecerá aquí

Data modeling with Amazon DynamoDB - ADB301 - New York AWS Summit

  1. 1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Data modeling with Amazon DynamoDB Alex DeBrie Engineering Manager Serverless, Inc. A D B 3 0 1
  2. 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Agenda What is DynamoDB? Key concepts Data modeling strategies
  3. 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Alex DeBrie Engineering Manager, Serverless, Inc. DynamoDBGuide.com @alexbdebrie alexdebrie.com
  4. 4. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  5. 5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T What is DynamoDB? NoSQL database Fully managed by AWS HTTPS with AWS Identity and Access Management (IAM) Auth Fast, consistent performance as it scales
  6. 6. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hyperscale
  7. 7. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Hyperephemeral compute
  8. 8. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  9. 9. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Concepts • Table • Item • Primary key • Attributes
  10. 10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  11. 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Table
  12. 12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Item
  13. 13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Primarykey
  14. 14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Attributes
  15. 15. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Primary key • Simple primary key (partition key) • Composite primary key (partition key + sort key)
  16. 16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Simple primarykey
  17. 17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Composite primarykey
  18. 18. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. API actions • Item-based actions
  19. 19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Item-based actions – Writing, updating, deleting
  20. 20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Item-based actions – Writing, updating, deleting Must provide entire primary key
  21. 21. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. API actions • Item-based actions • Query
  22. 22. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Query
  23. 23. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Query Must provide partition key May provide sort key conditions
  24. 24. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. API actions • Item-based actions • Query • Scan
  25. 25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Scan
  26. 26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Scan Avoid! Expensive at scale
  27. 27. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Secondary indexes
  28. 28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Secondaryindexes
  29. 29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Secondaryindexes
  30. 30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Secondaryindexes
  31. 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Secondaryindexes
  32. 32. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  33. 33. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Basics 1. Start with an ERD 2. Define your access patterns 3. Design your primary key & secondary indexes
  34. 34. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Forget your relational experience • Normalization • JOINs • One entity type per table
  35. 35. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Setup • Ecommerce store • Users make orders • An order may have many items
  36. 36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 1. Create your ERD
  37. 37. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Ecommerce store
  38. 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 2. Define your access patterns
  39. 39. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Identify access patterns 1. Get user profile 2. Get orders for user 3. Get single order and order items 4. Get orders for user by status 5. Get open orders
  40. 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T 3. Design your primary keys & secondary indexes
  41. 41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  42. 42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  43. 43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  44. 44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address Order Order item
  45. 45. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  46. 46. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  47. 47. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  48. 48. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Denormalization + document types
  49. 49. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address N/A N/A Order Order item
  50. 50. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  51. 51. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  52. 52. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T One-to-many: Sort keys
  53. 53. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address N/A N/A Order USER#<username> ORDER#<orderId> Order item
  54. 54. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address N/A N/A Order USER#<username> ORDER#<orderId> Order item
  55. 55. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Query: “PK = USER#alexdebrie AND BEGINS_WITH(SK, ‘ORDER#’)”
  56. 56. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T One-to-many: Sort keys “PK = USER#alexdebrie AND BEGINS_WITH(SK, ‘ORDER#’)”
  57. 57. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  58. 58. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  59. 59. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  60. 60. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address N/A N/A Order USER#<username> ORDER#<orderId> Order item ITEM#<itemId> ORDER#<orderId>
  61. 61. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Entities PK SK User USER#<username> #PROFILE#<username> User address N/A N/A Order USER#<username> ORDER#<orderId> Order item ITEM#<itemId> ORDER#<orderId>
  62. 62. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
  63. 63. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Inverted index
  64. 64. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Inverted index
  65. 65. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Inverted index
  66. 66. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. One-to-many relationship patterns 1. Attribute (list or map) 2. Primary key + query 3. Secondary index + query
  67. 67. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
  68. 68. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering SELECT * FROM ORDERS WHERE USERNAME = ‘alexdebrie’ AND ORDERDATE > GETDATE() - 14
  69. 69. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  70. 70. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  71. 71. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  72. 72. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  73. 73. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Query Must provide partition key May provide sort key conditions
  74. 74. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  75. 75. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  76. 76. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  77. 77. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  78. 78. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  79. 79. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  80. 80. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filter expressions
  81. 81. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders
  82. 82. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders
  83. 83. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders SELECT * FROM ORDERS WHERE USERNAME = ‘alexdebrie’
  84. 84. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering access patterns “PK = USER#alexdebrieAND BEGINS_WITH(SK, ‘ORDER#’)”
  85. 85. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering patterns: primary key “PK = USER#alexdebrieAND BEGINS_WITH(SK, ‘ORDER#’)”
  86. 86. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders
  87. 87. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders SELECT * FROM ORDERS WHERE USERNAME = ‘alexdebrie’ AND STATUS = ‘SHIPPED’
  88. 88. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie Filtering access pattern
  89. 89. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie Filtering access pattern
  90. 90. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie Filtering access pattern
  91. 91. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. S U M M I T@alexbdebrie Filtering patterns: composite sort key
  92. 92. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders SELECT * FROM ORDERS WHERE USERNAME = ‘alexdebrie’ AND STATUS = ‘SHIPPED’
  93. 93. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering patterns: Composite sort key “PK = USER#alexdebrieAND BEGINS_WITH(OrderStatusDate, ‘SHIPPED#’)”
  94. 94. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filtering patterns: Composite sort key “PK = USER#alexdebrieAND BEGINS_WITH(OrderStatusDate, ‘SHIPPED#’)”
  95. 95. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders
  96. 96. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders
  97. 97. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering access patterns 1. Get orders for user 2. Get orders by status for user 3. Get open orders SELECT * FROM ORDERS WHERE STATUS = ‘PLACED’
  98. 98. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filteringaccess patterns: Sparse index
  99. 99. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filteringaccess patterns: Sparse index
  100. 100. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Filteringaccess patterns: Sparse index
  101. 101. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Filtering patterns 1. Primary key 2. Composite sort key 3. Sparse index
  102. 102. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T Thank you! S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Alex DeBrie @alexbdebrie alexdebrie.com

×