TheRobotLearns Platform · ProxySQL: from first install to production
Prepared Statements Internals — quiz
Sources
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- Cache MySQL prepared-query results
- Cache MySQL prepared-query results
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- Prepared Statements
- MySQL Prepared Statements Architecture
- Cache MySQL prepared-query results
- Cache MySQL prepared-query results
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- Cache MySQL prepared-query results
- Cache MySQL prepared-query results
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
- Prepared Statements
- MySQL Prepared Statements Architecture
- Cache MySQL prepared-query results
- Cache MySQL prepared-query results
- MySQL Prepared Statements Architecture
- MySQL Prepared Statements Architecture
- MySQL Prepared Statement Lifecycle
Practice quiz
Try these as you read — answers are checked instantly and nothing is saved.
Q1. A client executes a prepared statement through ProxySQL. Which identifier does the backend receive?
Q2. A client prepared on one backend and now executes on another. How does ProxySQL route it?
Q3. Two clients prepare the same SQL as the same user and schema. What happens on the second prepare?
Q4. Two clients use identical SQL but different usernames. What does ProxySQL do?
Q5. A client closes the statement, but one backend still has it prepared. Can ProxySQL evict the global entry?
Q6. You prepare a statement already cached for the same SQL, user, and schema. What reaches the client?
Q7. On a cache miss, what is recorded after the backend returns a statement ID?
Q8. A client sends `COM_STMT_EXECUTE`. What does ProxySQL check first in the per-connection client map?
Q9. You prepared a statement against a reader hostgroup, then execute it inside a transaction on v2.1.0 or newer. Where does ProxySQL route it?
Q10. A client sends `COM_STMT_CLOSE` while other clients still reference the statement. What happens to its client reference count and backend?
Q11. You send `COM_STMT_CLOSE`, but a backend still has the statement. What stays true?
Q12. You close every client and every backend has recycled the statement. When is eviction possible?
Q13. An execution routes to a backend that has never seen the statement. What happens?
Q14. You prepare similar queries with slightly changed SQL text. What can happen in the global cache?
Q15. You upgrade ProxySQL and want prepared-query results to reuse cache entries. What selects them?
Q16. You set `cache_ttl=5000` for a label lookup. What does it allow?
Q17. Your prepared lookup rule should exclude empty result sets. Which value fits?
Q18. You repeat a prepared lookup inside an active transaction. What happens?
Q19. You repeated eligible traffic, then changed backend permissions. What verifies reuse, and what clears saved answers?
Q20. Which statement best describes the role of a global prepared statement identifier?
Q21. A client sends COM_STMT_PREPARE and ProxySQL finds an equivalent global prepared statement entry. What happens next?
Q22. When is a global prepared statement entry safe to evict?
Q23. Which context components are included in the content hash used to locate a global prepared statement entry? Select all that apply.
Q24. A binary prepared SELECT matches a mysql_query_rules entry with a positive cache_ttl. Which conditions can cause an execution to bypass prepared-query result reuse? Select all that apply.
Q25. Order the main actions ProxySQL takes when COM_STMT_PREPARE produces a global cache miss.
Q26. Order the steps when COM_STMT_EXECUTE for an already known prepared statement is routed to a different hostgroup than the original prepare hostgroup.
Q27. Match each capability enabled by ProxySQL’s two-tier prepared statement mapping to its mechanism.
Q28. Match each Admin counter from stats_mysql_global to the prepared-query result-cache insight it provides.
Q29. To immediately clear all saved MySQL result answers when cached rows might become unsafe, run: ____
Q30. A client prepares a statement and receives client-side ID 12. The prepare path first contacts backend connection B, where MySQL assigns ID 8. Later, COM_STMT_EXECUTE is routed to backend connection C, where the same global statement has not yet been prepared. Explain how ProxySQL handles the execute and why forwarding ID 12 or ID 8 directly would fail.
Q31. An application repeatedly executes a binary prepared lookup, SELECT label FROM public_labels WHERE id = ?, through a mysql_query_rules entry with cache_ttl=5000. A backend row is updated. Why might the next application read still return the old label, and when should an update-confirming read avoid the cached path?
Do more with an account
- Graded quizzes is available on your account.
- Saving your progress is available on your account.
- Hands-on labs is available on your account.
- AI tutoring is available on your account.