title: Determining a partition key in Dynamo DB for GSI
body: <p>I am new to DynamoDB and I am finding it hard to think of how I should decide my partition key. I am using a condensed version of my use case:</p>
  
  <p>I have an attribute which is a boolean value => B
  For a given ID, I need to return all the data for it. The ID is either X or Y attribute. For the given ID, if B is true, I need to read attribute X, else Y. </p>
  
  <p>While inserting into the table I know the the value of B and hence I can fill it in either X or Y depending on the value of it.</p>
  
  <p>However while fetching, I just am given an ID, and I need to figure out whether it exists in column X or column Y ( I won't be getting the value of B in the input). </p>
  
  <p>In a RDBMS I could run a query like <code>select * from tab where (B == true &amp;&amp; X == ID) || (B==false &amp;&amp; Y == ID)</code>. </p>
  
  <p>I think creating a GSI in DynamoDB will be the way to go about solving this in Dynamo. However I am not able to figure out the best way to approach this. Could I get suggestions? </p>