title: Why would LIMIT 2 queries work but LIMIT 1 always times out?
body: <p>I'm using this public Postgres DB of NEAR protocol: <a href="https://github.com/near/near-indexer-for-explorer#shared-public-access" rel="nofollow noreferrer">https://github.com/near/near-indexer-for-explorer#shared-public-access</a></p>
  <p><code>postgres://public_readonly:nearprotocol@mainnet.db.explorer.indexer.near.dev/mainnet_explorer</code></p>
  <pre class="lang-sql prettyprint-override"><code>SELECT &quot;public&quot;.&quot;receipts&quot;.&quot;receipt_id&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;included_in_block_hash&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;included_in_chunk_hash&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;index_in_chunk&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;included_in_block_timestamp&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;predecessor_account_id&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;receiver_account_id&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;receipt_kind&quot;,
      &quot;public&quot;.&quot;receipts&quot;.&quot;originated_from_transaction_hash&quot;
  FROM &quot;public&quot;.&quot;receipts&quot;
  WHERE (&quot;public&quot;.&quot;receipts&quot;.&quot;receipt_id&quot;) IN
          (SELECT &quot;t0&quot;.&quot;receipt_id&quot;
              FROM &quot;public&quot;.&quot;receipts&quot; AS &quot;t0&quot;
              INNER JOIN &quot;public&quot;.&quot;action_receipts&quot; AS &quot;j0&quot; ON (&quot;j0&quot;.&quot;receipt_id&quot;) = (&quot;t0&quot;.&quot;receipt_id&quot;)
              WHERE (&quot;j0&quot;.&quot;signer_account_id&quot; = 'ryancwalsh.near'
                                          AND &quot;t0&quot;.&quot;receipt_id&quot; IS NOT NULL))
  ORDER BY &quot;public&quot;.&quot;receipts&quot;.&quot;included_in_block_timestamp&quot; DESC
  LIMIT 1
  OFFSET 0
  </code></pre>
  <p>always results in:</p>
  <pre><code>ERROR:  canceling statement due to statement timeout
  SQL state: 57014
  </code></pre>
  <p>But if I change it to LIMIT 2, the query runs in less than 1 second.</p>
  <p>How would that ever be the case? Does that mean the database isn't set up well? Or am I doing something wrong?</p>
  <p>P.S. The query here was generated via Prisma. <code>findFirst</code> always times out, so I think I might need to change it to <code>findMany</code> as a workaround.</p>