ProxySQL can answer a repeated, read-only MySQL query from its own result-set cache instead of opening a backend connection and executing the SQL again. The safe way to use it is to identify shared reads, match them with narrow query rules, assign a TTL that reflects acceptable staleness, and verify the effect with cache and query-digest counters. ProxySQL caching is not a write-invalidation system: a cached result can remain visible until its hard TTL expires.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What ProxySQL query caching actually does
ProxySQL implements query caching on the wire. A client sends SQL to the proxy, the proxy evaluates query rules, and an eligible result set can be stored there. When a later request matches the cached entry while it is still valid, ProxySQL returns the stored rows without sending the query to MySQL. That can eliminate backend connection work, parsing, execution, row production, and network transfer between the proxy and server.
As an Amazon Associate I earn from qualifying purchases.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteThis is different from caching an object in application code. The application continues to issue SQL; ProxySQL decides whether that SQL can be answered locally. The benefit is transparent to clients, but the correctness boundary is the cache TTL and the exact set of requests matched by the rule.
The two freshness boundaries
- Soft TTL: an optional refresh threshold. A request that reaches this threshold can trigger a backend refresh while concurrent requests continue receiving the still-valid entry.
- Hard TTL: the expiry boundary. Once the configured
cache_ttlhas elapsed, the entry is no longer valid and a request must obtain a fresh result from MySQL.
ProxySQL documents no invalidation mechanism beyond TTL expiration. An update, insert, or delete on MySQL does not automatically remove a related cached result. Treat the hard TTL as the maximum period during which stale data can be served.
#1 Best Overall
- [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
- [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
- [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
- [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
- [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.
Choose queries that are safe to share
The highest-value candidates are read-only statements whose result is identical for many clients and expensive or frequent enough that avoiding execution matters. Begin with query-digest data rather than guessing from SQL text.
| Query class | Typical suitability | Reasoning | TTL approach |
|---|---|---|---|
| Reference and configuration data | Strong candidate | Many sessions read the same rows and changes are relatively infrequent. | Longer TTL, limited by how quickly a configuration change must become visible. |
| Expensive shared aggregates | Often suitable | Reports, counts, or summaries can consume substantial CPU and are reused by many requests. | Medium TTL based on the business tolerance for stale totals. |
| Volatile operational data | Usually exclude | Rapid updates make a cached answer misleading. | Do not cache unless a measured staleness window is acceptable. |
| User-specific reads | Usually exclude | Rows can depend on identity, permissions, tenant, session variables, or other context. | Exclude unless every dimension that changes the result is safely represented in the cache match. |
| Writes and write-like statements | Exclude | A write has side effects and caching its result can suppress required execution. | No query-cache rule. |
| Prepared statements | Incompatible | ProxySQL documents query-cache incompatibility with prepared statements. | Use another caching layer or change the access path only after testing protocol behavior. |
Reject context-sensitive SQL
Do not cache a statement merely because it starts with SELECT. Exclude statements that use session variables, temporary tables, connection-local state, user identity, permission-dependent predicates, non-deterministic functions, or time-dependent expressions unless you have verified that every request receiving the entry has equivalent semantics. A result that is correct for one session can be incorrect for the next session even when the SQL text looks similar.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Profile the workload before adding a rule
- Collect a baseline. Record backend latency, CPU, query volume, error rate, and the relevant rows in ProxySQL’s query-digest statistics for a representative period that includes normal traffic.
- Find repeatable reads. Look for read-only digests with high execution counts, meaningful execution time, and a result that can be shared safely across clients.
- Rank the opportunity. A practical ranking is execution cost multiplied by repeat frequency. A very slow query that runs once a day may matter less than a moderately expensive query executed thousands of times per minute.
- Inspect result size. Large result sets can consume cache memory quickly. A small, frequently repeated result often gives a better memory-to-backend-work trade-off than a large report.
- Confirm the protocol. Check whether the application uses prepared statements for the candidate. Query caching is documented as incompatible with them, so a rule that appears correct may never produce hits for that traffic.
Keep the baseline. Without before-and-after measurements, a rising hit counter does not prove that backend CPU, latency, or connection demand improved.
Set a TTL from the freshness requirement
cache_ttl is configured per query rule in milliseconds. Choose it from the maximum acceptable staleness, not from a generic “fast is better” target. If a catalog change must appear within two minutes, a TTL longer than two minutes violates that requirement unless another mechanism prevents stale reads. Because expiry is the documented invalidation path, a database write alone is not a freshness guarantee.
Rank #2
- 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
- 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
- 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
- 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
- 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.
| Question | How it determines TTL |
|---|---|
| How long may a client see old data? | This is the upper bound for the hard TTL. |
| How often does the underlying data change? | Frequent changes generally require a shorter TTL or exclusion. |
| How expensive is a miss? | More expensive work can justify a longer bounded-staleness window if users accept it. |
| How much memory can the proxy dedicate? | Shorter TTLs reduce retained entries over time, but memory also depends on result size and query variety. |
| Is a stale empty result harmful? | Decide explicitly whether empty result sets should be cached. |
The official example uses cache_ttl = 5000, which means 5,000 milliseconds (five seconds). That value is an example, not a universal recommendation. A five-second TTL may be appropriate for a rapidly changing dashboard and far too short for static reference data.
Use soft TTL when refresh work should be smoothed
The global variable mysql-query_cache_soft_ttl_pct accepts 0–100 percent and has a documented default of 0. When set to a nonzero percentage, an entry can reach its soft threshold before its hard TTL. The next requester can refresh it from MySQL while other concurrent requests still receive the valid old entry. This can reduce a burst of simultaneous misses, but it does not extend the hard freshness boundary. A soft refresh is not invalidation and should not be used to justify a longer hard TTL.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Write the smallest possible query rule
Use match_digest for a normalized query shape or match_pattern for a tightly scoped regular expression. An anchored rule that identifies one known statement is safer than a broad rule that matches every read. Include cache_empty_result deliberately: caching “no rows” can prevent repeated expensive misses, but it can also hide a newly inserted row until expiry.
INSERT INTO mysql_query_rules
(rule_id, active, match_digest, cache_ttl, cache_empty_result, apply)
VALUES
(1, 1, '^SELECT', 5000, 1, 1);
LOAD MYSQL QUERY RULES TO RUNTIME;
SAVE MYSQL QUERY RULES TO DISK;
This official-style example caches matching SELECT statements for 5,000 milliseconds and stores empty results. Do not deploy the ^SELECT matcher unchanged on a production system: it is intentionally broad and can capture user-specific, volatile, or context-sensitive reads. Replace it with the narrowest digest or pattern that identifies the approved query class.
Rank #3
- [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
- [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
- [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
- [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
- [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by
Make exclusions win over broad inclusions
If a deployment has a broad inclusion rule, place an exclusion rule ahead of it according to the rule ordering used by that deployment. For example, explicitly exclude a sensitive digest before a general read rule can match it. Keep rule IDs, matchers, and comments in version control so an operator can see why a statement is included or excluded.
Query annotations can request a per-query cache_ttl. Annotations are evaluated before query rules, and a rule can supersede the annotated value. Treat annotations as an input to the policy, not as a guarantee that bypasses the rule set.
Activate changes safely
- Insert or update the rule in the
mysql_query_rulesconfiguration table. - Review the matcher, TTL in milliseconds, empty-result decision, and ordering against both included and excluded digests.
- Run
LOAD MYSQL QUERY RULES TO RUNTIME;so the running proxy uses the change. - Exercise the target query with a controlled request and confirm that the result is correct for more than one eligible client context.
- Persist the tested configuration with
SAVE MYSQL QUERY RULES TO DISK;so a restart does not discard it. - Roll out one query class at a time. Keep a rollback statement or previous rule definition ready, and watch backend and cache counters during the rollout.
Loading to runtime without saving leaves the change vulnerable to restart loss; saving without loading leaves the running process on the old rules. Both operations are required for a persistent production change.
Size and tune the cache memory
mysql-query_cache_size_MB controls the configured query-cache memory target. ProxySQL describes this as a soft limit managed by a background purging thread, not a strict hard cap. The documented behavior also does not provide LRU eviction when limits are reached. Consequently, adding more cacheable query shapes can increase memory pressure without guaranteeing that the least useful entries will be discarded first.
Rank #4
- Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
- Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
- All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
- Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
- Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.
- Start with a memory allocation that the host can afford alongside ProxySQL’s connection handling and other processes.
- Watch
Query_Cache_Memory_bytesandQuery_Cache_Entrieswhile traffic is representative. - Reduce broad matchers and large result sets before simply increasing the memory setting.
- Use TTLs that match freshness requirements; a long TTL retains entries longer but does not automatically improve hit rate if query shapes are rarely repeated.
Cache memory is shared operational capacity. A cache that saves backend CPU but causes host memory contention can make the overall system less reliable.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Verify that caching is doing useful work
Inspect the stats_mysql_query_cache counters and fields together with query-digest data. The names below are the operational signals to track:
Free tools Windows power users keep installed
One-click scans. No signup required.
| Metric | What it tells you |
|---|---|
Query_Cache_count_GET |
How many cache lookups were attempted. |
Query_Cache_count_GET_OK |
How many lookups returned a cached result; compare this with GET attempts to estimate the hit ratio. |
Query_Cache_count_SET |
How often a result was inserted into the cache after execution. |
Query_Cache_Memory_bytes |
Current memory occupied by cached results. |
Query_Cache_Purged |
How many entries have been purged; correlate spikes with memory or expiry behavior. |
Query_Cache_Entries |
Current number of stored entries. |
A useful estimated hit ratio is Query_Cache_count_GET_OK / Query_Cache_count_GET, provided the counters cover the same observation interval and the denominator is nonzero. Validate the ratio against backend evidence: lower executions for the targeted digest, reduced backend CPU or latency, and no increase in stale-data incidents or errors. A high hit ratio on an insignificant query is not a meaningful optimization.
Troubleshoot zero or disappointing cache hits
The rule is not active in the running proxy
Confirm that the rule exists in mysql_query_rules, is active, and was loaded with LOAD MYSQL QUERY RULES TO RUNTIME;. If the proxy was restarted, verify that the rule was also saved to disk.
Best Value
The matcher does not match the actual digest
Compare the production query-digest entry with the rule’s match_digest or match_pattern. Whitespace normalization, comments, parameter forms, capitalization, and small shape differences can prevent a match. Tighten or correct the expression from observed digest data rather than editing it from memory.
A later rule or exclusion wins
Inspect rule ordering and any earlier rule that routes, rewrites, or excludes the statement. Put deliberate exclusions before broad cache rules and test the complete ordered set, not an isolated row.
The traffic uses prepared statements
Prepared statements are a documented query-cache incompatibility. In that case, a correct-looking rule can still produce no cache hits. Confirm the client protocol and use a cache design compatible with the application’s execution method.
Every request is a miss because results are too diverse
User IDs, tenant predicates, timestamps, random values, or other varying inputs can create many distinct query shapes or semantically unsafe results. Exclude those statements unless the result is genuinely shared and the matching policy accounts for every dimension that affects it.
Empty results are behaving unexpectedly
Check the rule’s cache_empty_result value and the global mysql-query_cache_stores_empty_result behavior. If an empty result is cached, a later insert may not be visible until the hard TTL expires. If empty results are not cached, repeated misses can continue to consume backend resources.
Prevent stale or incorrect data
- Document the maximum tolerated staleness beside each rule and make the hard TTL no longer than that limit.
- Exclude data whose correctness depends on an immediate write-to-read transition.
- Exclude permission-sensitive or session-sensitive statements unless equivalent context is guaranteed.
- Test both populated and empty responses, including the period immediately after a write.
- Monitor application reports of stale data, not just cache counters.
- When freshness requirements change, shorten or remove the rule; do not assume a write will flush it.
If the application needs explicit invalidation after a write, object-level control, or a guarantee tied to a particular record, ProxySQL’s TTL-only query cache may be the wrong abstraction. An application cache or dedicated key-value cache can provide those semantics, but it adds application logic and its own consistency and operational costs. Choose between them using freshness guarantees, expected hit rate, backend CPU saved, memory footprint, query-shape selectivity, prepared-statement compatibility, and operational complexity.
A practical rollout checklist
- Baseline query-digest frequency, latency, backend CPU, and connection demand.
- Identify a shared, deterministic, read-only query with a measurable execution cost.
- Write down its maximum acceptable staleness and choose a hard TTL in milliseconds.
- Decide whether empty results are safe to cache.
- Use a narrow digest or anchored pattern; avoid a blanket SELECT rule.
- Place exclusions ahead of broad inclusions where rule order matters.
- Check for prepared statements and session-dependent behavior.
- Load rules to runtime, test correctness, then save them to disk.
- Set a memory target appropriate for the host and watch the soft-limit behavior.
- Track GET, GET_OK, SET, memory, purge, and entry counters alongside backend metrics.
- Roll back quickly if stale data, memory pressure, or backend errors increase.
What success looks like
A successful ProxySQL cache change is not simply a nonzero hit counter. The targeted digest should show fewer executions or less backend work, client latency should improve for the affected requests, memory should remain controlled, and the observed staleness should stay within the documented TTL boundary. Start with one high-repeat shared read, prove those outcomes, and only then extend caching to another query class.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




