Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

ProxySQL can answer a repeated MySQL read from its own query cache, avoiding a backend connection and SQL execution on a cache hit. The safe way to use it is to cache only shared, repeatable reads, give each query class a deliberate millisecond TTL, and verify the result with cache and query-digest counters. ProxySQL caching is not a general-purpose invalidation system: a changed row does not remove an old result, so stale data can remain until the hard TTL expires.

What ProxySQL query caching actually does

ProxySQL sits between clients and MySQL. Query rules are evaluated before a statement is sent to a backend server. When a rule enables caching and a matching result is still valid, ProxySQL returns the stored result set directly. The request does not need to acquire a backend connection or execute the SQL on MySQL.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The cache stores complete result sets, not individual rows or application objects. A cache key is therefore tied to the query shape and the request context ProxySQL uses when matching it. Two statements that produce different text, parameters, or relevant context may not share an entry even if they are logically similar. Conversely, a broad rule can make unrelated reads share a policy they should not share. Query-rule scope is the main safety control.

cache_ttl is the hard freshness boundary for a rule and is measured in milliseconds. When that period ends, the entry is no longer served as a valid cached result and a backend request is needed to repopulate it. ProxySQL documents no invalidation mechanism beyond TTL expiration. A write to MySQL therefore does not automatically purge a result that was cached earlier.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Find the right queries before changing configuration

Start with workload evidence rather than with a blanket rule such as “cache every SELECT.” Inspect ProxySQL query-digest data and identify statements that are both expensive and repeated. A useful prioritization is execution cost multiplied by repeat frequency: a moderately expensive query requested thousands of times can be a better target than a very expensive report requested once a day.

For every candidate, record the query shape, whether the result is shared by many users, how quickly the underlying data changes, whether an empty result is meaningful, and whether the client uses a prepared statement. This inventory prevents a high hit rate from masking incorrect results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Read-only: the statement must not modify data or depend on side effects.
  • Shared result: the same result can safely be returned to different callers.
  • Repeatable: the query occurs often enough that a cache entry will be reused.
  • Bounded staleness: the owner of the data accepts the selected TTL as the maximum age of a served result.
  • Protocol compatibility: the request path must not rely on a prepared statement, which ProxySQL documents as incompatible with query caching.

Choose data that is safe to serve slightly stale

The strongest candidates are shared reads whose value changes infrequently or whose consumers can tolerate a short delay. Reference tables, feature or configuration data, country and currency lists, and other lookup results often fit. Expensive aggregates and dashboard summaries can also benefit when a boundedly stale number is preferable to repeatedly consuming backend CPU.

Exclude statements whose result depends on a user, session, temporary state, or nondeterministic evaluation unless the deployment has specifically verified the semantics. Examples include per-user account pages, authorization-sensitive queries, statements influenced by session variables, temporary tables, and reads that use current time or another changing value. A result that is safe for one identity may be wrong or confidential when returned to another.

Query class Typical policy Why
Reference and configuration reads Long TTL, narrow rule Values are shared and change relatively rarely.
Expensive shared aggregates Medium TTL, with an agreed freshness limit Repeated computation can consume substantial backend CPU.
Frequently changing shared lists Short TTL or no cache A long window would expose noticeable staleness.
User-specific or authorization-sensitive reads Exclude A cached result may cross identity or policy boundaries.
Session-, temporary-table-, or nondeterministic reads Exclude unless semantics are proven The result depends on context not represented safely by a shared entry.
Writes and statements with side effects Exclude Query caching is for repeatable reads, not mutations.

Set TTL from the freshness requirement

TTL should be chosen by the maximum age a consumer can accept, not by an arbitrary performance target. Treat it as a contract: if a five-second TTL is selected, a caller may receive a result that is nearly five seconds old even when the source row changed immediately after the cache was filled.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
  • Long-TTL class: use for stable reference or configuration data after confirming how changes are deployed and communicated.
  • Medium-TTL class: use for shared aggregates where a few minutes of staleness is acceptable and backend work is significant.
  • Short-TTL class: use for data that changes regularly but still benefits from coalescing bursts of identical reads.
  • Excluded class: use when any stale result is unacceptable, when the result is private, or when context makes a shared entry unsafe.

Because TTL is the only documented invalidation path, coordinate it with operational changes. If an administrator changes configuration data and the application must see the change immediately, waiting for the existing hard TTL may violate that requirement. In that situation, shorten the policy, avoid caching the query, or use an application-level design with explicit invalidation rather than assuming a MySQL write will clear ProxySQL’s entry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Write a narrow query rule

ProxySQL’s mysql_query_rules table supports matching with match_digest or match_pattern. Prefer the smallest matcher that identifies the intended query class. A digest-based rule is useful when normalized query shapes are stable; a tightly scoped pattern can be appropriate when you need to distinguish a particular form. Avoid matching every SELECT in production unless you have proved that every selected result is safe to share and tolerate the same TTL.

The official documentation shows this basic configuration:

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 rule gives matching statements a 5,000-millisecond TTL and allows empty result sets to be cached. It is a demonstration, not a production matcher. Replace ^SELECT with a digest or pattern that identifies one approved query class, and give each class the TTL that its data owner accepts.

Decide whether empty results belong in the cache

cache_empty_result controls whether a query returning no rows can create a cache entry. Caching an empty result can protect the backend from repeated misses when a key is genuinely absent. It can also prolong the appearance of “not found” after a row is inserted. Make the choice deliberately, and check the related global behavior controlled by mysql-query_cache_stores_empty_result. The rule-level setting and global policy must agree with the application’s expectations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

Account for rule ordering

When a broad inclusion rule and a safety exclusion could both match, put the exclusion ahead of the inclusion according to the rule-ordering behavior of your deployment. This is especially important during a gradual rollout: an explicitly excluded query should not fall through to a later catch-all cache rule.

Load and persist changes

Editing mysql_query_rules does not by itself make the new policy active everywhere. Load the rules to runtime, test the target query, and save the working configuration to disk so a restart does not discard it. Roll out one query class at a time rather than changing every read simultaneously; that makes hit-rate, latency, and correctness changes attributable.

Use soft TTL when refresh should happen before expiry

mysql-query_cache_soft_ttl_pct provides an optional refresh window. It accepts a percentage from 0 to 100, and the documented default is 0 percent. With a nonzero value, an entry can reach the soft threshold while it is still inside its hard cache_ttl. The next requester can trigger a backend refresh, while concurrent requests continue receiving the still-valid cached result. The hard TTL remains the final expiry boundary.

Soft TTL is useful when you want to avoid a synchronized burst of misses at hard expiry. It does not create immediate invalidation and does not make stale data impossible. Choose the percentage only after deciding how much of the TTL may be used for refresh, and monitor backend load during that window. A refresh that is too aggressive can erase the CPU savings you expected from caching.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Size and monitor the cache

Set mysql-query_cache_size_MB with the proxy’s available memory in mind. The documented limit is soft: a background purging thread manages pressure rather than enforcing a strict hard cap at the instant an entry is added. ProxySQL also documents that there is no LRU eviction mechanism when limits are reached. This makes entry selection and TTL discipline important; a large collection of low-value entries can consume memory without producing useful hits.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Inspect the stats_mysql_query_cache counters and fields together with query-digest data. The following values show whether the cache is doing useful work:

Metric What it tells you How to use it
Query_Cache_count_GET Number of cache lookup attempts Confirms that requests are reaching cache evaluation.
Query_Cache_count_GET_OK Successful cache lookups Compare with GET to calculate an observed hit ratio.
Query_Cache_count_SET Entries written after backend execution Shows how often misses populate the cache.
Query_Cache_Memory_bytes Memory currently used by cached results Relate memory growth to the value of the hits.
Query_Cache_Purged Entries removed by purging activity Investigate churn, pressure, and short-lived entries.
Query_Cache_Entries Number of stored entries Compare entry count with memory and query classes.

You can inspect the cache statistics from the ProxySQL administration interface, for example with:

SELECT * FROM stats_mysql_query_cache;

Do not judge success from Query_Cache_count_GET_OK alone. Compare backend latency, CPU consumption, and query volume before and after enabling each rule. A high hit ratio on a trivial query may save little, while a smaller number of hits on an expensive aggregate can materially reduce backend work. Also check that response correctness and freshness remain within the agreed limits.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot zero hits and unexpected behavior

Lookups are zero

  • Confirm the rule is active and was loaded to runtime after editing.
  • Check that the query actually matches match_digest or match_pattern; whitespace, comments, and normalization can produce a different shape than expected.
  • Verify that another rule is not excluding the statement or stopping evaluation before the cache rule.
  • Confirm that the request path is not using a prepared statement, which the query cache does not support.
  • Run the same eligible read more than once. The first request normally populates the entry; later identical requests are the ones that can hit.

Lookups occur but successful hits stay low

Low hit rates usually mean the result is being requested with many distinct shapes or parameters, the TTL is too short for reuse, or entries are being purged before another request arrives. Use query-digest data to see whether the supposedly repeated statement is actually fragmented into many forms. Tighten the matcher only after confirming that the forms are semantically interchangeable, and remove cache rules that create memory usage without reuse.

Results are stale

Staleness is expected within the selected TTL because writes do not invalidate entries. Reduce the hard TTL, exclude the query, or redesign the read path if the freshness requirement has changed. Do not attempt to solve a correctness problem by merely increasing memory or soft-TTL refresh; neither provides write-triggered invalidation.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Memory rises or purging is frequent

Review Query_Cache_Memory_bytes, Query_Cache_Entries, and Query_Cache_Purged together. Broad rules, large result sets, and long TTLs can create many low-value entries. Narrow the matcher, shorten TTLs for volatile classes, exclude large or private responses, and set mysql-query_cache_size_MB in line with the proxy’s available memory. Because the limit is soft and eviction is not LRU-based, prevention is more predictable than relying on emergency purging.

Empty-result behavior is surprising

Check both the rule’s cache_empty_result value and the global mysql-query_cache_stores_empty_result setting. If a missing row may be created shortly afterward, caching an empty result can extend the period during which callers see “not found.” If repeated misses are expensive and absence is stable, caching the empty result may be worthwhile.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Handle prepared statements and query annotations correctly

ProxySQL documents query caching as incompatible with prepared statements. If an application depends on prepared statements for a candidate query, do not assume that adding a cache rule will produce hits. Either leave that statement uncached or verify a different, supported request path before changing application behavior.

Query annotations can request a per-query cache_ttl. An annotation is evaluated before query rules, and a matching rule may supersede it. Treat annotations as an additional control, not as proof that a statement will bypass all policy. Test the effective behavior through the cache counters and the actual response path.

Compare ProxySQL caching with other cache layers

ProxySQL is strongest when many callers issue the same safe read and the desired unit is the complete SQL result set. It requires no application-side object serialization and can prevent backend connection and execution work on a hit. Its trade-off is that freshness is time-based and invalidation is limited to TTL expiration.

An application cache or a dedicated key-value cache may be a better architectural fit when the application needs explicit invalidation after a write, object-level keys, user-aware authorization, or a data model different from SQL result sets. That choice is workload-specific; compare the alternatives on the following axes before implementation:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Decision axis ProxySQL query cache What to verify in an alternative
Freshness Hard TTL; no documented write invalidation Whether changes can invalidate exactly the affected object or key
Hit potential Highest for identical shared query results Whether requests can share a normalized object or key
Backend work saved Can avoid backend connection acquisition and SQL execution on a hit Whether the layer prevents the same database work
Memory footprint Complete result sets stored at the proxy; soft memory limit Serialization size, eviction policy, and ownership of memory
Prepared statements Documented incompatibility Compatibility with the application’s protocol
Operational complexity Query rules, TTL classes, counters, and purge behavior Invalidation, deployment, monitoring, and failure handling

A safe rollout plan

  1. Baseline the workload. Capture query-digest frequency, execution latency, backend CPU, and query volume for the candidate statement before caching.
  2. Define the freshness contract. Write down the maximum acceptable age and whether an empty result may be cached.
  3. Classify the query. Confirm that it is read-only, shared, deterministic enough for a shared result, and not prepared-statement based.
  4. Create the narrowest rule. Use match_digest or a tightly scoped match_pattern; set cache_ttl, cache_empty_result, and apply explicitly.
  5. Protect exclusions. Place any exclusion ahead of a broader inclusion rule where ordering matters.
  6. Load and save. Run LOAD MYSQL QUERY RULES TO RUNTIME;, test the request, then run SAVE MYSQL QUERY RULES TO DISK; after validation.
  7. Observe one class. Watch GET, GET_OK, SET, memory, entries, purges, backend latency, CPU, and query volume before adding another rule.
  8. Adjust or revert. Shorten TTL, narrow the matcher, disable empty-result caching, or remove the rule if correctness, memory, or backend metrics do not improve.

Practical decision checklist

  • Can the same result safely be returned to every caller who matches this query?
  • What is the maximum acceptable age of that result?
  • Will a write need to be visible before the TTL expires?
  • Does the statement depend on identity, session variables, temporary state, or nondeterministic values?
  • Is the client using a prepared statement?
  • Should an empty result be cached?
  • Is the matcher narrow enough to avoid unrelated SELECT statements?
  • Do cache hits save meaningful backend CPU or latency compared with the memory consumed?
  • Are cache statistics and query-digest data included in ongoing monitoring?

Final guidance

Use ProxySQL query caching as a selective acceleration layer, not as a universal MySQL cache. Profile first, cache shared reads with a clear freshness contract, keep matchers narrow, and treat the hard TTL as the only guaranteed invalidation boundary. A rollout is successful only when cache counters show real reuse and backend work falls without exposing stale, private, or context-dependent results.

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.