title: DynamoDB : Global Secondary Index utilisation in queries
body: <p>I am coming from RDMS background and I started using DynamoDB recently.</p>
  
  <p>I have following DyamoDB table with three Global Secondary Indexes (GSI)</p>
  
  <blockquote>
    <p>Id (<strong>primary key</strong>), user_id(<strong>GSI</strong>), event_type (<strong>GSI</strong>), product_id (<strong>GSI</strong>)
    , rate, create_date</p>
  </blockquote>
  
  <p>I have following three query patterns:</p>
  
  <ul>
  <li>a) WHERE event_type=? </li>
  <li>b) WHERE event_type=? AND product_id=? </li>
  <li>c) WHERE product_id=? </li>
  <li>d) WHERE product_id=? AND user_id=?</li>
  </ul>
  
  <p>I know in MySQL I need to create following indexes to optimize above queries :</p>
  
  <ul>
  <li>composite index (event_type,product_id) : for queries "a" and "b"</li>
  <li>composite index (product_id,user_id) : for queries "c" and "d" </li>
  </ul>
  
  <p>My question is , if I create three GSIs for 'event_type', 'product_id' and 'user_id' fields in DyanomoDB, do the query patterns "b" and "d" utilize these three independent GSIs ?</p>