title: How to Speed Up Simple Join
body: <p>I am no good at SQL.</p>
  
  <p>I am looking for a way to speed up a simple join like this:</p>
  
  <pre><code>SELECT
      E.expressionID,
      A.attributeName,
      A.attributeValue
  FROM 
      attributes A
  JOIN
      expressions E
  ON 
      E.attributeId = A.attributeId
  </code></pre>
  
  <p>I am doing this dozens of thousands times and it's taking more and more as the table gets bigger.</p>
  
  <p>I am thinking indexes - If I was to speed up selects on the single tables I'd probably put nonclustered indexes on expressionID for the expressions table and another on (attributeName, attributeValue) for the attributes table - but I don't know how this could apply to the join.</p>
  
  <p><strong>EDIT</strong>: I already have a clustered index on expressionId (PK), attributeId (PK, FK) on the expressions table and another clustered index on attributeId (PK) on the attributes table</p>
  
  <p>I've seen <a href="https://stackoverflow.com/questions/272665/speed-up-sql-join">this</a> question but I am asking for something more general and probably far simpler.</p>
  
  <p>Any help appreciated!</p>