TheRobotLearns Platform · ProxySQL: from first install to production

Prepared Statements Internals — quiz

  • about 20 min read

Sources

Practice quiz

Try these as you read — answers are checked instantly and nothing is saved.

  1. Q1. A client executes a prepared statement through ProxySQL. Which identifier does the backend receive?

    Answer for question 1
  2. Q2. A client prepared on one backend and now executes on another. How does ProxySQL route it?

    Answer for question 2
  3. Q3. Two clients prepare the same SQL as the same user and schema. What happens on the second prepare?

    Answer for question 3
  4. Q4. Two clients use identical SQL but different usernames. What does ProxySQL do?

    Answer for question 4
  5. Q5. A client closes the statement, but one backend still has it prepared. Can ProxySQL evict the global entry?

    Answer for question 5
  6. Q6. You prepare a statement already cached for the same SQL, user, and schema. What reaches the client?

    Answer for question 6
  7. Q7. On a cache miss, what is recorded after the backend returns a statement ID?

    Answer for question 7
  8. Q8. A client sends `COM_STMT_EXECUTE`. What does ProxySQL check first in the per-connection client map?

    Answer for question 8
  9. 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?

    Answer for question 9
  10. Q10. A client sends `COM_STMT_CLOSE` while other clients still reference the statement. What happens to its client reference count and backend?

    Answer for question 10
  11. Q11. You send `COM_STMT_CLOSE`, but a backend still has the statement. What stays true?

    Answer for question 11
  12. Q12. You close every client and every backend has recycled the statement. When is eviction possible?

    Answer for question 12
  13. Q13. An execution routes to a backend that has never seen the statement. What happens?

    Answer for question 13
  14. Q14. You prepare similar queries with slightly changed SQL text. What can happen in the global cache?

    Answer for question 14
  15. Q15. You upgrade ProxySQL and want prepared-query results to reuse cache entries. What selects them?

    Answer for question 15
  16. Q16. You set `cache_ttl=5000` for a label lookup. What does it allow?

    Answer for question 16
  17. Q17. Your prepared lookup rule should exclude empty result sets. Which value fits?

    Answer for question 17
  18. Q18. You repeat a prepared lookup inside an active transaction. What happens?

    Answer for question 18
  19. Q19. You repeated eligible traffic, then changed backend permissions. What verifies reuse, and what clears saved answers?

    Answer for question 19
  20. Q20. Which statement best describes the role of a global prepared statement identifier?

    Answer for question 20
  21. Q21. A client sends COM_STMT_PREPARE and ProxySQL finds an equivalent global prepared statement entry. What happens next?

    Answer for question 21
  22. Q22. When is a global prepared statement entry safe to evict?

    Answer for question 22
  23. Q23. Which context components are included in the content hash used to locate a global prepared statement entry? Select all that apply.

    Answer for question 23
  24. 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.

    Answer for question 24
  25. Q25. Order the main actions ProxySQL takes when COM_STMT_PREPARE produces a global cache miss.

    Answer for question 25
  26. 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.

    Answer for question 26
  27. Q27. Match each capability enabled by ProxySQL’s two-tier prepared statement mapping to its mechanism.

    Answer for question 27
  28. Q28. Match each Admin counter from stats_mysql_global to the prepared-query result-cache insight it provides.

    Answer for question 28
  29. Q29. To immediately clear all saved MySQL result answers when cached rows might become unsafe, run: ____

    Answer for question 29
  30. 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.

    Answer for question 30
  31. 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?

    Answer for question 31

Do more with an account

Prepared Statements Internals — quiz — ProxySQL: from first install to production