title: Which type of index is needed for has_many relation with where statement
body: <p>I have a frequently used query where <code>User</code> model <code>has_many :payments</code>:</p>
  <pre><code>current_user.payments.where(status: &quot;succeeded&quot;).order(&quot;created_at DESC&quot;).page(params[:page]).per(params[:size])
  </code></pre>
  <p>Which of these indexes would I need? Or would I need all three of them?</p>
  <pre><code>add_index :payments, :user_id
  add_index :payments, :status, order: {created_at: :desc})
  add_index :payments, [:user_id, :status], order: {created_at: :desc})
  </code></pre>
  <p><strong>Edit:</strong></p>
  <p>The <code>page()</code> and <code>per()</code> in the query are from <a href="https://github.com/kaminari/kaminari" rel="nofollow noreferrer">kaminari gem</a>. Do I need additional indexes for these?</p>