Troubleshooting
Problem
In DataStax Enterprise (DSE) and Apache Cassandra, a "prepared statement discarded" warning or error typically indicates that the prepared statement cache has reached its maximum capacity, and the database is discarding the least recently used prepared statements to make room for new ones. This situation can have performance implications since discarding prepared statements means they need to be prepared again, which incurs additional overhead.
If you repeatedly see messages about prepared statements being discarded because the cache limit has been reached:
- Investigate the root cause of these messages and check whether prepared statements are used correctly by using bind markers for variable parts.: The size of the prepared statement cache is configurable. If the cache size is too small for your application's needs, it may lead to frequent discarding of prepared statements.
- You can increase the prepared statement cache size in the
cassandra.yamlconfiguration file. The relevant setting is oftenprepared_statements_cache_size_mb. Adjusting this value to better suit your workload can reduce the frequency of cache evictions.
If you're frequently encountering this issue, it's advisable to review your application's query patterns and the database configuration. Sometimes, the solution might be as simple as increasing the cache size, but in other cases, it might require a more in-depth analysis of how your application prepares and executes queries.
Last Reviewed : 2023-11-13
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB76","label":"Data Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSCR56","label":"IBM DataStax Enterprise"},"ARM Category":[{"code":"","label":""}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]
Historical Number
ka06R000000HcYfQAK
Was this topic helpful?
Document Information
Modified date:
30 January 2026
UID
ibm17258891