About read consistency
The consistency level specifies how many replicas must respond to a read request before returning data to the client application.
Cassandra checks the specified number of replicas for data to satisfy the read request.
| Level | Description | Usage |
|---|---|---|
ALL |
Returns the record after all replicas have responded. The read operation will fail if a replica does not respond. | Provides the highest consistency of all levels and the lowest availability of all levels. |
EACH_QUORUM |
Not supported for reads. | Not supported for reads. |
QUORUM |
Returns the record after a quorum of replicas has responded from any data center. | Ensures strong consistency if you can tolerate some level of failure. |
LOCAL_QUORUM |
Returns the record after a quorum of replicas in the current data center as the coordinator has reported. Avoids latency of inter-data center communication. | Used in multiple data center clusters with a rack-aware replica placement strategy ( NetworkTopologyStrategy) and a properly configured snitch. Fails when using SimpleStrategy. |
ONE |
Returns a response from the closest replica, as determined by the snitch. By default, a read repair runs in the background to make the other replicas consistent. | Provides the highest availability of all the levels if you can tolerate a comparatively high probability of stale data being read. The replicas contacted for reads may not always have the most recent write. |
TWO |
Returns the most recent data from two of the closest replicas. | Similar to ONE. |
THREE |
Returns the most recent data from three of the closest replicas. | Similar to TWO. |
LOCAL_ONE |
Returns a response from the closest replica in the local data center. | Same usage as described in the table about write consistency levels. |
SERIAL |
Allows reading the current (and possibly uncommitted) state of data without proposing a new addition or update. If a SERIAL read finds an uncommitted transaction in progress, it will commit the transaction as part of the read. Similar to QUORUM. |
To read the latest value of a column after a user has invoked a lightweight transaction to write to the column, use SERIAL. Cassandra then checks the inflight lightweight transaction for updates and, if found, returns the latest data. |
LOCAL_SERIAL |
Same as SERIAL, but confined to the data center. Similar to LOCAL_QUORUM. |
Used to achieve linearizable consistency for lightweight transactions. |