ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Rust Driver Speculative execution

Caution

You're viewing documentation for an unstable version of ScyllaDB Rust Driver. Switch to the latest stable version.

Speculative execution¶

Speculative query execution is an optimization technique where a driver pre-emptively starts a second execution of a query against another node, before the first node has replied.

There are multiple speculative execution strategies that the driver can use. Speculative execution can be configured for the whole whole Session during its creation.

Available speculative execution strategies:

  • Simple

  • Latency Percentile

Speculative execution is not enabled by default, and currently only non-iter session methods use it.

When does speculative execution actually fire?¶

Even with a SpeculativeExecutionPolicy configured on the Session, speculative fibers only start if the statement is marked idempotent (see Query idempotence). For non-idempotent statements the policy is bypassed and only the original execution runs - this avoids duplicating side-effecting writes when several fibers race to the same coordinator. Use Statement::set_is_idempotent(true) or PreparedStatement::set_is_idempotent(true) on queries that are safe to re-run.

Errors from running fibers¶

Once speculative fibers are running, the result of each fiber is checked against an internal classifier. Errors that look transient on this particular target (for example, a connection-pool error or an attempt that another node could still satisfy) are ignored so the remaining fibers keep racing. Errors that mean the whole request should fail - not just one fiber - are returned immediately, and no more speculative attempts are started. From a user perspective this means some kinds of failure produce a fast error even when speculative execution is configured: speculative fibers are an optimization for slow responses, not a substitute for retry on definitive errors.

Was this page helpful?

PREVIOUS
Downgrading consistency retry policy
NEXT
Simple speculative execution
  • Create an issue
  • Edit this page

On this page

  • Speculative execution
    • When does speculative execution actually fire?
    • Errors from running fibers
ScyllaDB Rust Driver
Search Ask AI
  • main
    • main
    • v1.7.0
    • v1.6.0
    • v1.5.0
    • v1.4.1
    • v1.4.0
    • v1.3.1
    • v1.3.0
    • v1.2.0
  • ScyllaDB Rust Driver
  • Quick Start
    • Creating a project
    • Connecting and running a simple query
    • Running ScyllaDB using Docker
  • Connecting to the cluster
    • Compression
    • Authentication
    • TLS
    • Client Routes (Private Networking)
  • Executing CQL statements - best practices
    • Unprepared statement
    • Statement values
    • Query result
    • Prepared statement
    • Batch statement
    • Paged query
    • USE keyspace
    • Schema agreement
    • Lightweight transaction (LWT) statement
    • Request timeouts
    • Timestamp generators
  • Execution profiles
    • Creating a profile and setting it
    • All options supported by a profile
    • Priorities of execution settings
    • Remapping execution profile handles
  • Data Types
    • Bool, Tinyint, Smallint, Int, Bigint, Float, Double
    • Ascii, Text, Varchar
    • Counter
    • Blob
    • Inet
    • Uuid
    • Timeuuid
    • Date
    • Time
    • Timestamp
    • Duration
    • Decimal
    • Varint
    • List, Set, Map
    • Tuple
    • User defined types
    • Vector
  • Load balancing
    • DefaultPolicy
  • Retry policy configuration
    • Fallthrough retry policy
    • Default retry policy
    • Downgrading consistency retry policy
  • Speculative execution
    • Simple speculative execution
    • Percentile speculative execution
  • Driver metrics
  • Migration guides
    • Adjusting code to changes in serialization API introduced in 0.11
    • Adjusting code to changes in deserialization API introduced in 0.15
  • Logging
  • Query tracing
    • Tracing a simple/prepared/batch query
    • Tracing a paged query
    • Tracing Session::prepare
    • Query Execution History
  • Schema
Docs Tutorials University Contact Us About Us
© 2026, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 19 June 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.2