title: What is efficient way to read stale data in Spanner using node or java client?
body: <p>our use case allows to read stale data (between 10 to 15s) so exploring staleness read using node or java client. In node we have <code>Database.getSnapshot</code> or <code>Database.runStream(sql, option)</code> -option we can mention different staleness strategy.</p>
  
  <p><code>Snapshot</code> - we can have database, table, transaction snapshot, but database snapshot does not accept any option where as transaction snapshot accept option for Timebound.  </p>
  
  <p>My question is which way is effective way to read stale data?</p>
  
  <p>1) using Database.getSnapshot or table.getSnapshot or transaction.getSnapshot?</p>
  
  <p>2) using Database.runStream(sql, option) with max, exact staleness</p>
  
  <h2>Update</h2>
  
  <p>In node, I followed example mentioned in the link <a href="https://googleapis.dev/nodejs/spanner/latest/Snapshot.html#Snapshot-examples" rel="nofollow noreferrer">https://googleapis.dev/nodejs/spanner/latest/Snapshot.html#Snapshot-examples</a>. and my code as follows</p>
  
  <pre class="lang-js prettyprint-override"><code>const timestampBounds = {
          strong: false,
          maxStaleness: 15000
        }
        databse.getSnapshot(timestampBounds, async (err, trans) =&gt; {
          if (err) {
            console.error(err);
            return;
          }
  
          const [qOneRows] = await trans.run(query)
          //resolve(qOneRows);
  
          trans.end();
  
        } );
  </code></pre>
  
  <p>I am getting below error</p>
  
  <pre><code>{ Error: 3 INVALID_ARGUMENT: Bad BeginTransaction request.
    at Object.exports.createStatusError (/workspace/session-monitoring/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:1204:28)
    at InterceptingListener._callNext (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:618:8)
    at Object.onReceiveStatus (/workspace/session-monitoring/node_modules/grpc-gcp/src/index.ts:155:13)
    at InterceptingListener._callNext (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/workspace/session-monitoring/node_modules/grpc/src/client_interceptors.js:845:24)
  code: 3,
  metadata:
   Metadata {
     _internal_repr:
      { 'google.rpc.badrequest-bin': [Array],
        'grpc-status-details-bin': [Array],
        'grpc-server-stats-bin': [Array] },
     flags: 0 },
  details: 'Bad BeginTransaction request.',
  note:
   'Exception occurred in retry method that was not classified as transient' }
  </code></pre>
  
  <p>My spanner version is "@google-cloud/spanner": "^4.0.2"
  Node version is v10.11.0</p>