Query Annotations
Overview
ProxySQL supports query annotations to customize individual query behaviour. Annotations are included in comments preceding queries:
SELECT /*+ ;cache_ttl=0;query_timeout=100 */ c FROM sbtest3 WHERE id=2
Annotations override global variable settings for specific queries. ProxySQL evaluates annotations
before query rules, so mysql_query_rules settings may supersede annotations.
Supported Annotations
| Annotation | Purpose |
|---|---|
cache_ttl | Cache duration in milliseconds |
query_delay | Delay before processing (milliseconds) |
query_retries | Number of retry attempts |
query_timeout | Maximum execution time (milliseconds) |
hostgroup | Target hostgroup destination |
mirror | Activates query mirroring with mirror_hostgroup |
max_lag_ms | Maximum Aurora replica replication lag |
min_epoch_ms | Minimum epoch time threshold for server selection |
min_gtid | Minimum required GTID on target server |
create_new_connection | Forces new backend connection instead of reusing pooled connection |