Query timeout not applied for Prepared Statements

Query timeout not applied for Prepared Statements

Hi Team,

I’m using the Couchbase Python SDK to execute a prepared statement by name. I have configured time_options / timeout on the query, but the timeout does not seem to take effect when executing the prepared statement.

Observed behavior:

  • If the prepared statement is not available on the cluster, the execution becomes long-running.

  • Even though a timeout is configured, the query continues running instead of failing early.

  • Questions:

    1. Is this expected behavior in the Couchbase Python SDK when executing prepared statements by name?

    2. Are query timeouts applied only during execution after the prepared statement is found?

    3. What is the recommended production-ready approach to handle timeouts when a prepared statement is missing?

Any statements has multiple parts

  1. parse
  2. plan
  3. execution

prepare statement skip 1,2. Once it finds prepare statement in the cache and do only 3

timeout of any statement starts for step 3 only

If prepare statements not available , it returns error. Most cases SDKs will pass query text again and prepare and execute. So enable SDK debug and see what is going on.

You can even try execute prepare statement in UI (execute preparename) or cbq shell or curl and see if that gives error immidiately