dojo.md 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/courses/GENERATION_LOG.md +45 -0
  2. package/courses/aws-lambda-debugging/course.yaml +11 -0
  3. package/courses/aws-lambda-debugging/scenarios/level-1/api-gateway-integration.yaml +71 -0
  4. package/courses/aws-lambda-debugging/scenarios/level-1/cloudwatch-logs-basics.yaml +64 -0
  5. package/courses/aws-lambda-debugging/scenarios/level-1/cold-start-basics.yaml +70 -0
  6. package/courses/aws-lambda-debugging/scenarios/level-1/environment-variable-issues.yaml +72 -0
  7. package/courses/aws-lambda-debugging/scenarios/level-1/first-debugging-shift.yaml +73 -0
  8. package/courses/aws-lambda-debugging/scenarios/level-1/handler-import-errors.yaml +71 -0
  9. package/courses/aws-lambda-debugging/scenarios/level-1/iam-permission-errors.yaml +68 -0
  10. package/courses/aws-lambda-debugging/scenarios/level-1/invocation-errors.yaml +72 -0
  11. package/courses/aws-lambda-debugging/scenarios/level-1/lambda-timeout-errors.yaml +65 -0
  12. package/courses/aws-lambda-debugging/scenarios/level-1/memory-and-oom.yaml +70 -0
  13. package/courses/aws-lambda-debugging/scenarios/level-2/async-invocation-failures.yaml +72 -0
  14. package/courses/aws-lambda-debugging/scenarios/level-2/cold-start-optimization.yaml +76 -0
  15. package/courses/aws-lambda-debugging/scenarios/level-2/dynamodb-streams-debugging.yaml +70 -0
  16. package/courses/aws-lambda-debugging/scenarios/level-2/intermediate-debugging-shift.yaml +71 -0
  17. package/courses/aws-lambda-debugging/scenarios/level-2/lambda-concurrency-management.yaml +70 -0
  18. package/courses/aws-lambda-debugging/scenarios/level-2/lambda-layers-debugging.yaml +76 -0
  19. package/courses/aws-lambda-debugging/scenarios/level-2/sam-local-debugging.yaml +74 -0
  20. package/courses/aws-lambda-debugging/scenarios/level-2/sqs-event-source.yaml +72 -0
  21. package/courses/aws-lambda-debugging/scenarios/level-2/vpc-networking-issues.yaml +71 -0
  22. package/courses/aws-lambda-debugging/scenarios/level-2/xray-tracing.yaml +62 -0
  23. package/courses/aws-lambda-debugging/scenarios/level-3/advanced-debugging-shift.yaml +72 -0
  24. package/courses/aws-lambda-debugging/scenarios/level-3/container-image-lambda.yaml +79 -0
  25. package/courses/aws-lambda-debugging/scenarios/level-3/cross-account-invocation.yaml +72 -0
  26. package/courses/aws-lambda-debugging/scenarios/level-3/eventbridge-patterns.yaml +79 -0
  27. package/courses/aws-lambda-debugging/scenarios/level-3/iac-deployment-debugging.yaml +68 -0
  28. package/courses/aws-lambda-debugging/scenarios/level-3/kinesis-stream-processing.yaml +64 -0
  29. package/courses/aws-lambda-debugging/scenarios/level-3/lambda-at-edge.yaml +64 -0
  30. package/courses/aws-lambda-debugging/scenarios/level-3/lambda-extensions-debugging.yaml +67 -0
  31. package/courses/aws-lambda-debugging/scenarios/level-3/powertools-observability.yaml +79 -0
  32. package/courses/aws-lambda-debugging/scenarios/level-3/step-functions-debugging.yaml +80 -0
  33. package/courses/aws-lambda-debugging/scenarios/level-4/cost-optimization-strategy.yaml +67 -0
  34. package/courses/aws-lambda-debugging/scenarios/level-4/expert-debugging-shift.yaml +62 -0
  35. package/courses/aws-lambda-debugging/scenarios/level-4/incident-management-serverless.yaml +61 -0
  36. package/courses/aws-lambda-debugging/scenarios/level-4/multi-region-serverless.yaml +67 -0
  37. package/courses/aws-lambda-debugging/scenarios/level-4/observability-platform-design.yaml +71 -0
  38. package/courses/aws-lambda-debugging/scenarios/level-4/serverless-architecture-design.yaml +64 -0
  39. package/courses/aws-lambda-debugging/scenarios/level-4/serverless-data-architecture.yaml +66 -0
  40. package/courses/aws-lambda-debugging/scenarios/level-4/serverless-migration-strategy.yaml +65 -0
  41. package/courses/aws-lambda-debugging/scenarios/level-4/serverless-security-design.yaml +60 -0
  42. package/courses/aws-lambda-debugging/scenarios/level-4/serverless-testing-strategy.yaml +62 -0
  43. package/courses/aws-lambda-debugging/scenarios/level-5/board-serverless-strategy.yaml +63 -0
  44. package/courses/aws-lambda-debugging/scenarios/level-5/consulting-serverless-adoption.yaml +57 -0
  45. package/courses/aws-lambda-debugging/scenarios/level-5/industry-serverless-patterns.yaml +62 -0
  46. package/courses/aws-lambda-debugging/scenarios/level-5/ma-serverless-integration.yaml +75 -0
  47. package/courses/aws-lambda-debugging/scenarios/level-5/master-debugging-shift.yaml +61 -0
  48. package/courses/aws-lambda-debugging/scenarios/level-5/organizational-serverless-transformation.yaml +65 -0
  49. package/courses/aws-lambda-debugging/scenarios/level-5/regulatory-serverless.yaml +61 -0
  50. package/courses/aws-lambda-debugging/scenarios/level-5/serverless-economics.yaml +65 -0
  51. package/courses/aws-lambda-debugging/scenarios/level-5/serverless-future-technology.yaml +66 -0
  52. package/courses/aws-lambda-debugging/scenarios/level-5/serverless-platform-design.yaml +71 -0
  53. package/courses/docker-container-debugging/course.yaml +11 -0
  54. package/courses/docker-container-debugging/scenarios/level-1/container-exit-codes.yaml +59 -0
  55. package/courses/docker-container-debugging/scenarios/level-1/container-networking-basics.yaml +69 -0
  56. package/courses/docker-container-debugging/scenarios/level-1/docker-logs-debugging.yaml +67 -0
  57. package/courses/docker-container-debugging/scenarios/level-1/dockerfile-build-failures.yaml +71 -0
  58. package/courses/docker-container-debugging/scenarios/level-1/environment-variable-issues.yaml +74 -0
  59. package/courses/docker-container-debugging/scenarios/level-1/first-debugging-shift.yaml +70 -0
  60. package/courses/docker-container-debugging/scenarios/level-1/image-pull-failures.yaml +68 -0
  61. package/courses/docker-container-debugging/scenarios/level-1/port-mapping-issues.yaml +67 -0
  62. package/courses/docker-container-debugging/scenarios/level-1/resource-limits-oom.yaml +70 -0
  63. package/courses/docker-container-debugging/scenarios/level-1/volume-mount-problems.yaml +66 -0
  64. package/courses/docker-container-debugging/scenarios/level-2/container-health-checks.yaml +73 -0
  65. package/courses/docker-container-debugging/scenarios/level-2/docker-compose-debugging.yaml +66 -0
  66. package/courses/docker-container-debugging/scenarios/level-2/docker-exec-debugging.yaml +71 -0
  67. package/courses/docker-container-debugging/scenarios/level-2/image-layer-optimization.yaml +81 -0
  68. package/courses/docker-container-debugging/scenarios/level-2/intermediate-debugging-shift.yaml +73 -0
  69. package/courses/docker-container-debugging/scenarios/level-2/logging-and-log-rotation.yaml +76 -0
  70. package/courses/docker-container-debugging/scenarios/level-2/multi-stage-build-debugging.yaml +76 -0
  71. package/courses/docker-container-debugging/scenarios/level-2/network-debugging-tools.yaml +67 -0
  72. package/courses/docker-container-debugging/scenarios/level-2/pid1-signal-handling.yaml +71 -0
  73. package/courses/docker-container-debugging/scenarios/level-2/security-scanning-basics.yaml +67 -0
  74. package/courses/docker-container-debugging/scenarios/level-3/advanced-debugging-shift.yaml +77 -0
  75. package/courses/docker-container-debugging/scenarios/level-3/buildkit-optimization.yaml +67 -0
  76. package/courses/docker-container-debugging/scenarios/level-3/container-filesystem-debugging.yaml +70 -0
  77. package/courses/docker-container-debugging/scenarios/level-3/container-security-hardening.yaml +74 -0
  78. package/courses/docker-container-debugging/scenarios/level-3/disk-space-management.yaml +74 -0
  79. package/courses/docker-container-debugging/scenarios/level-3/docker-api-automation.yaml +72 -0
  80. package/courses/docker-container-debugging/scenarios/level-3/docker-daemon-issues.yaml +73 -0
  81. package/courses/docker-container-debugging/scenarios/level-3/docker-in-docker-ci.yaml +69 -0
  82. package/courses/docker-container-debugging/scenarios/level-3/overlay-network-debugging.yaml +70 -0
  83. package/courses/docker-container-debugging/scenarios/level-3/production-container-ops.yaml +71 -0
  84. package/courses/docker-container-debugging/scenarios/level-4/cicd-pipeline-design.yaml +66 -0
  85. package/courses/docker-container-debugging/scenarios/level-4/container-monitoring-observability.yaml +63 -0
  86. package/courses/docker-container-debugging/scenarios/level-4/container-orchestration-strategy.yaml +62 -0
  87. package/courses/docker-container-debugging/scenarios/level-4/container-performance-engineering.yaml +64 -0
  88. package/courses/docker-container-debugging/scenarios/level-4/container-security-architecture.yaml +66 -0
  89. package/courses/docker-container-debugging/scenarios/level-4/enterprise-image-management.yaml +58 -0
  90. package/courses/docker-container-debugging/scenarios/level-4/expert-debugging-shift.yaml +63 -0
  91. package/courses/docker-container-debugging/scenarios/level-4/incident-response-containers.yaml +70 -0
  92. package/courses/docker-container-debugging/scenarios/level-4/multi-environment-management.yaml +65 -0
  93. package/courses/docker-container-debugging/scenarios/level-4/stateful-service-containers.yaml +65 -0
  94. package/courses/docker-container-debugging/scenarios/level-5/board-infrastructure-strategy.yaml +58 -0
  95. package/courses/docker-container-debugging/scenarios/level-5/consulting-container-strategy.yaml +61 -0
  96. package/courses/docker-container-debugging/scenarios/level-5/container-platform-architecture.yaml +67 -0
  97. package/courses/docker-container-debugging/scenarios/level-5/container-platform-economics.yaml +67 -0
  98. package/courses/docker-container-debugging/scenarios/level-5/container-technology-evolution.yaml +67 -0
  99. package/courses/docker-container-debugging/scenarios/level-5/disaster-recovery-containers.yaml +66 -0
  100. package/courses/docker-container-debugging/scenarios/level-5/industry-container-patterns.yaml +71 -0
  101. package/courses/docker-container-debugging/scenarios/level-5/master-debugging-shift.yaml +62 -0
  102. package/courses/docker-container-debugging/scenarios/level-5/organizational-transformation.yaml +67 -0
  103. package/courses/docker-container-debugging/scenarios/level-5/regulatory-compliance-containers.yaml +61 -0
  104. package/courses/kubernetes-deployment-troubleshooting/course.yaml +12 -0
  105. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/configmap-secret-issues.yaml +69 -0
  106. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/crashloopbackoff.yaml +68 -0
  107. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/deployment-rollout.yaml +56 -0
  108. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/first-troubleshooting-shift.yaml +65 -0
  109. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/health-probe-failures.yaml +70 -0
  110. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/imagepullbackoff.yaml +57 -0
  111. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/kubectl-debugging-basics.yaml +56 -0
  112. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/oomkilled.yaml +70 -0
  113. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/pending-pods.yaml +68 -0
  114. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-1/service-not-reachable.yaml +66 -0
  115. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/dns-resolution-failures.yaml +63 -0
  116. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/helm-deployment-failures.yaml +63 -0
  117. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/hpa-scaling-issues.yaml +62 -0
  118. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/ingress-routing-issues.yaml +63 -0
  119. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/init-container-failures.yaml +63 -0
  120. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/intermediate-troubleshooting-shift.yaml +66 -0
  121. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/network-policy-blocking.yaml +67 -0
  122. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/persistent-volume-issues.yaml +69 -0
  123. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/rbac-permission-denied.yaml +57 -0
  124. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-2/resource-quota-limits.yaml +64 -0
  125. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/advanced-troubleshooting-shift.yaml +69 -0
  126. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/cluster-upgrade-failures.yaml +71 -0
  127. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/gitops-drift-detection.yaml +62 -0
  128. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/job-cronjob-failures.yaml +67 -0
  129. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/monitoring-alerting-gaps.yaml +64 -0
  130. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/multi-container-debugging.yaml +68 -0
  131. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/node-pressure-evictions.yaml +70 -0
  132. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/pod-disruption-budgets.yaml +59 -0
  133. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/service-mesh-debugging.yaml +64 -0
  134. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-3/statefulset-troubleshooting.yaml +69 -0
  135. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/capacity-planning.yaml +65 -0
  136. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/cost-optimization.yaml +57 -0
  137. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/disaster-recovery-design.yaml +56 -0
  138. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/executive-communication.yaml +62 -0
  139. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/expert-troubleshooting-shift.yaml +65 -0
  140. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/incident-management-process.yaml +59 -0
  141. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/multi-cluster-operations.yaml +62 -0
  142. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/multi-tenancy-design.yaml +55 -0
  143. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/platform-engineering.yaml +59 -0
  144. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-4/security-hardening.yaml +58 -0
  145. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/behavioral-science.yaml +62 -0
  146. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/board-strategy.yaml +61 -0
  147. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/cloud-native-future.yaml +65 -0
  148. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/comprehensive-platform.yaml +57 -0
  149. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/consulting-engagement.yaml +62 -0
  150. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/industry-benchmarks.yaml +58 -0
  151. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/ma-integration.yaml +62 -0
  152. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/master-troubleshooting-shift.yaml +73 -0
  153. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/product-development.yaml +65 -0
  154. package/courses/kubernetes-deployment-troubleshooting/scenarios/level-5/regulatory-compliance.yaml +76 -0
  155. package/courses/mysql-query-optimization/course.yaml +11 -0
  156. package/courses/mysql-query-optimization/scenarios/level-1/buffer-pool-basics.yaml +65 -0
  157. package/courses/mysql-query-optimization/scenarios/level-1/explain-basics.yaml +66 -0
  158. package/courses/mysql-query-optimization/scenarios/level-1/first-optimization-shift.yaml +78 -0
  159. package/courses/mysql-query-optimization/scenarios/level-1/innodb-index-fundamentals.yaml +68 -0
  160. package/courses/mysql-query-optimization/scenarios/level-1/join-basics.yaml +66 -0
  161. package/courses/mysql-query-optimization/scenarios/level-1/n-plus-one-queries.yaml +67 -0
  162. package/courses/mysql-query-optimization/scenarios/level-1/query-rewriting-basics.yaml +66 -0
  163. package/courses/mysql-query-optimization/scenarios/level-1/select-star-problems.yaml +68 -0
  164. package/courses/mysql-query-optimization/scenarios/level-1/slow-query-diagnosis.yaml +65 -0
  165. package/courses/mysql-query-optimization/scenarios/level-1/where-clause-optimization.yaml +65 -0
  166. package/courses/mysql-query-optimization/scenarios/level-2/buffer-pool-tuning.yaml +64 -0
  167. package/courses/mysql-query-optimization/scenarios/level-2/composite-index-design.yaml +71 -0
  168. package/courses/mysql-query-optimization/scenarios/level-2/covering-and-invisible-indexes.yaml +69 -0
  169. package/courses/mysql-query-optimization/scenarios/level-2/cte-and-window-functions.yaml +78 -0
  170. package/courses/mysql-query-optimization/scenarios/level-2/intermediate-optimization-shift.yaml +68 -0
  171. package/courses/mysql-query-optimization/scenarios/level-2/join-optimization.yaml +67 -0
  172. package/courses/mysql-query-optimization/scenarios/level-2/performance-schema-analysis.yaml +69 -0
  173. package/courses/mysql-query-optimization/scenarios/level-2/query-optimizer-hints.yaml +74 -0
  174. package/courses/mysql-query-optimization/scenarios/level-2/subquery-optimization.yaml +70 -0
  175. package/courses/mysql-query-optimization/scenarios/level-2/write-optimization.yaml +63 -0
  176. package/courses/mysql-query-optimization/scenarios/level-3/advanced-optimization-shift.yaml +71 -0
  177. package/courses/mysql-query-optimization/scenarios/level-3/connection-management.yaml +67 -0
  178. package/courses/mysql-query-optimization/scenarios/level-3/full-text-search.yaml +77 -0
  179. package/courses/mysql-query-optimization/scenarios/level-3/json-optimization.yaml +87 -0
  180. package/courses/mysql-query-optimization/scenarios/level-3/lock-contention-analysis.yaml +68 -0
  181. package/courses/mysql-query-optimization/scenarios/level-3/monitoring-alerting.yaml +63 -0
  182. package/courses/mysql-query-optimization/scenarios/level-3/online-schema-changes.yaml +79 -0
  183. package/courses/mysql-query-optimization/scenarios/level-3/partitioning-strategies.yaml +83 -0
  184. package/courses/mysql-query-optimization/scenarios/level-3/query-profiling-deep-dive.yaml +84 -0
  185. package/courses/mysql-query-optimization/scenarios/level-3/replication-optimization.yaml +66 -0
  186. package/courses/mysql-query-optimization/scenarios/level-4/aurora-vs-rds-evaluation.yaml +61 -0
  187. package/courses/mysql-query-optimization/scenarios/level-4/data-architecture.yaml +62 -0
  188. package/courses/mysql-query-optimization/scenarios/level-4/database-migration-planning.yaml +59 -0
  189. package/courses/mysql-query-optimization/scenarios/level-4/enterprise-governance.yaml +50 -0
  190. package/courses/mysql-query-optimization/scenarios/level-4/executive-communication.yaml +54 -0
  191. package/courses/mysql-query-optimization/scenarios/level-4/expert-optimization-shift.yaml +67 -0
  192. package/courses/mysql-query-optimization/scenarios/level-4/high-availability-architecture.yaml +60 -0
  193. package/courses/mysql-query-optimization/scenarios/level-4/optimizer-internals.yaml +62 -0
  194. package/courses/mysql-query-optimization/scenarios/level-4/performance-sla-design.yaml +52 -0
  195. package/courses/mysql-query-optimization/scenarios/level-4/read-replica-scaling.yaml +51 -0
  196. package/courses/mysql-query-optimization/scenarios/level-5/ai-database-future.yaml +45 -0
  197. package/courses/mysql-query-optimization/scenarios/level-5/behavioral-science.yaml +44 -0
  198. package/courses/mysql-query-optimization/scenarios/level-5/benchmark-design.yaml +47 -0
  199. package/courses/mysql-query-optimization/scenarios/level-5/board-strategy.yaml +48 -0
  200. package/courses/mysql-query-optimization/scenarios/level-5/comprehensive-platform.yaml +49 -0
  201. package/courses/mysql-query-optimization/scenarios/level-5/consulting-engagement.yaml +52 -0
  202. package/courses/mysql-query-optimization/scenarios/level-5/ma-database-integration.yaml +47 -0
  203. package/courses/mysql-query-optimization/scenarios/level-5/master-optimization-shift.yaml +56 -0
  204. package/courses/mysql-query-optimization/scenarios/level-5/product-development.yaml +48 -0
  205. package/courses/mysql-query-optimization/scenarios/level-5/regulatory-compliance.yaml +48 -0
  206. package/courses/postgresql-query-optimization/scenarios/level-5/comprehensive-database-system.yaml +70 -0
  207. package/courses/postgresql-query-optimization/scenarios/level-5/database-ai-future.yaml +81 -0
  208. package/courses/postgresql-query-optimization/scenarios/level-5/database-behavioral-science.yaml +63 -0
  209. package/courses/postgresql-query-optimization/scenarios/level-5/database-board-strategy.yaml +77 -0
  210. package/courses/postgresql-query-optimization/scenarios/level-5/database-consulting-engagement.yaml +61 -0
  211. package/courses/postgresql-query-optimization/scenarios/level-5/database-industry-benchmarks.yaml +64 -0
  212. package/courses/postgresql-query-optimization/scenarios/level-5/database-ma-integration.yaml +71 -0
  213. package/courses/postgresql-query-optimization/scenarios/level-5/database-product-development.yaml +72 -0
  214. package/courses/postgresql-query-optimization/scenarios/level-5/database-regulatory-landscape.yaml +76 -0
  215. package/courses/postgresql-query-optimization/scenarios/level-5/master-optimization-shift.yaml +66 -0
  216. package/courses/terraform-infrastructure-setup/course.yaml +11 -0
  217. package/courses/terraform-infrastructure-setup/scenarios/level-1/terraform-init-errors.yaml +72 -0
  218. package/dist/mcp/session-manager.d.ts +7 -4
  219. package/dist/mcp/session-manager.d.ts.map +1 -1
  220. package/dist/mcp/session-manager.js +23 -8
  221. package/dist/mcp/session-manager.js.map +1 -1
  222. package/package.json +1 -1
@@ -0,0 +1,77 @@
1
+ meta:
2
+ id: full-text-search
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Implement MySQL full-text search — use FULLTEXT indexes, natural language and boolean modes, and relevance ranking for search features"
7
+ tags: [MySQL, full-text-search, FULLTEXT, MATCH-AGAINST, relevance, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your e-commerce site's product search is using LIKE '%keyword%'
13
+ queries, which cause full table scans on 5 million products. The
14
+ search page takes 8 seconds. You need to implement proper full-text
15
+ search using MySQL's built-in FULLTEXT indexes.
16
+
17
+ Current query (slow):
18
+ SELECT * FROM products
19
+ WHERE name LIKE '%wireless headphones%'
20
+ OR description LIKE '%wireless headphones%'
21
+ ORDER BY created_at DESC
22
+ LIMIT 20;
23
+ -- EXPLAIN: type=ALL, rows=5M, Using filesort
24
+
25
+ Products table:
26
+ CREATE TABLE products (
27
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
28
+ name VARCHAR(200) NOT NULL,
29
+ description TEXT,
30
+ category_id INT NOT NULL,
31
+ price DECIMAL(10,2) NOT NULL,
32
+ rating DECIMAL(3,2),
33
+ created_at DATETIME,
34
+ INDEX idx_category (category_id)
35
+ ) ENGINE=InnoDB;
36
+
37
+ Requirements:
38
+ 1. Search by keyword across name and description
39
+ 2. Results ranked by relevance (not just date)
40
+ 3. Support for boolean operators (+must -exclude "exact phrase")
41
+ 4. Search within a specific category
42
+ 5. Boost exact name matches over description matches
43
+ 6. Handle misspellings and partial matches
44
+
45
+ Search use cases to support:
46
+ A. Simple search: "wireless headphones"
47
+ B. Boolean search: "+wireless +headphones -bluetooth"
48
+ C. Phrase search: '"noise cancelling"'
49
+ D. Category-filtered search: wireless headphones in Electronics
50
+ E. Weighted relevance: name matches ranked higher than description
51
+
52
+ Questions:
53
+ 1. How does FULLTEXT indexing work in InnoDB?
54
+ 2. Natural language mode vs boolean mode — when to use each?
55
+ 3. How to combine FULLTEXT with other WHERE conditions?
56
+ 4. How to weight name matches higher than description matches?
57
+ 5. When to use MySQL FTS vs Elasticsearch?
58
+
59
+ Task: Implement the full-text search. Write: the FULLTEXT index
60
+ creation, the MATCH...AGAINST query for each use case, the relevance
61
+ ranking approach (weighting name vs description), the combined
62
+ filtering (FULLTEXT + category), and the comparison with
63
+ Elasticsearch for when MySQL FTS isn't enough.
64
+
65
+ assertions:
66
+ - type: llm_judge
67
+ criteria: "FULLTEXT implementation is correct — creates FULLTEXT INDEX on (name, description), uses MATCH(name, description) AGAINST('wireless headphones' IN NATURAL LANGUAGE MODE) for simple search and IN BOOLEAN MODE for operator search. Shows how to combine with WHERE category_id = ? using AND"
68
+ weight: 0.35
69
+ description: "Correct FULLTEXT implementation"
70
+ - type: llm_judge
71
+ criteria: "Relevance weighting is addressed — uses separate MATCH expressions: (MATCH(name) AGAINST(...) * 2 + MATCH(description) AGAINST(...)) AS relevance to weight name matches 2x higher. Requires FULLTEXT index on name alone AND a separate FULLTEXT index on (name, description). Explains that all MATCH columns must correspond to a single FULLTEXT index"
72
+ weight: 0.35
73
+ description: "Relevance weighting"
74
+ - type: llm_judge
75
+ criteria: "Limitations and Elasticsearch comparison are discussed — MySQL FTS limitations: no fuzzy matching (typo tolerance), no synonyms, no faceted search, minimum word length (ft_min_word_len), stopword issues. Elasticsearch is better for: complex search UX, faceted navigation, typo tolerance, multilingual search. MySQL FTS is sufficient for: basic keyword search, small-to-medium datasets, when simplicity matters"
76
+ weight: 0.30
77
+ description: "Limitations and Elasticsearch comparison"
@@ -0,0 +1,87 @@
1
+ meta:
2
+ id: json-optimization
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Optimize MySQL JSON queries — use generated columns, functional indexes, multi-valued indexes, and JSON_TABLE for efficient JSON processing"
7
+ tags: [MySQL, JSON, generated-columns, multi-valued-index, JSON-TABLE, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your application stores product metadata as JSON in MySQL 8.0. As
13
+ the product catalog grows to 5M rows, JSON queries are becoming slow
14
+ because they can't use indexes effectively.
15
+
16
+ Table schema:
17
+ CREATE TABLE products (
18
+ id BIGINT AUTO_INCREMENT PRIMARY KEY,
19
+ name VARCHAR(200) NOT NULL,
20
+ category_id INT NOT NULL,
21
+ metadata JSON NOT NULL,
22
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
23
+ INDEX idx_category (category_id)
24
+ ) ENGINE=InnoDB;
25
+
26
+ Sample JSON in metadata column:
27
+ {
28
+ "brand": "AcmeCorp",
29
+ "price": 29.99,
30
+ "currency": "USD",
31
+ "tags": ["electronics", "sale", "new-arrival"],
32
+ "dimensions": {"width": 10, "height": 5, "depth": 3},
33
+ "ratings": {"average": 4.5, "count": 230},
34
+ "variants": [
35
+ {"color": "red", "sku": "ACM-001-R", "stock": 50},
36
+ {"color": "blue", "sku": "ACM-001-B", "stock": 0}
37
+ ]
38
+ }
39
+
40
+ Slow queries:
41
+ 1. Filter by brand (50K queries/day, 2 seconds each):
42
+ SELECT * FROM products
43
+ WHERE JSON_EXTRACT(metadata, '$.brand') = 'AcmeCorp';
44
+ -- Full table scan — no index on JSON field
45
+
46
+ 2. Filter by tag (20K queries/day, 3 seconds each):
47
+ SELECT * FROM products
48
+ WHERE JSON_CONTAINS(metadata->'$.tags', '"sale"');
49
+ -- Full table scan — can't index arrays normally
50
+
51
+ 3. Price range (30K queries/day, 1.5 seconds each):
52
+ SELECT * FROM products
53
+ WHERE CAST(JSON_EXTRACT(metadata, '$.price') AS DECIMAL(10,2))
54
+ BETWEEN 20 AND 50;
55
+ -- Full table scan — CAST prevents index usage
56
+
57
+ 4. Join JSON array with another table:
58
+ SELECT p.name, t.tag_name
59
+ FROM products p, JSON_TABLE(
60
+ p.metadata, '$.tags[*]' COLUMNS (tag_name VARCHAR(50) PATH '$')
61
+ ) t
62
+ WHERE t.tag_name IN ('electronics', 'sale');
63
+
64
+ Optimization options:
65
+ A. Generated columns + regular indexes
66
+ B. Functional indexes (MySQL 8.0.13+)
67
+ C. Multi-valued indexes for arrays (MySQL 8.0.17+)
68
+ D. Denormalize into regular columns
69
+
70
+ Task: Optimize each slow query. Write: the generated column approach
71
+ (extract JSON to indexed column), functional indexes (direct index on
72
+ JSON expression), multi-valued indexes (for JSON arrays), JSON_TABLE
73
+ usage and performance, and when to denormalize vs keep JSON.
74
+
75
+ assertions:
76
+ - type: llm_judge
77
+ criteria: "Each query has a correct optimization — Query 1: functional index on JSON_EXTRACT(metadata, '$.brand') or generated column + index, Query 2: multi-valued index on CAST(metadata->'$.tags' AS CHAR(50) ARRAY) for JSON_CONTAINS, Query 3: generated column brand_price DECIMAL AS (metadata->>'$.price') STORED + regular index, Query 4: JSON_TABLE is for ad-hoc use, consider denormalizing for frequent joins"
78
+ weight: 0.35
79
+ description: "Correct optimizations"
80
+ - type: llm_judge
81
+ criteria: "Multi-valued indexes are explained — MySQL 8.0.17+ allows indexing JSON arrays, enabling efficient MEMBER OF(), JSON_CONTAINS(), and JSON_OVERLAPS() queries. Shows the CREATE INDEX syntax with CAST(... AS ... ARRAY), explains that it creates one index entry per array element, and notes limitations (only works with specific JSON functions)"
82
+ weight: 0.35
83
+ description: "Multi-valued indexes explained"
84
+ - type: llm_judge
85
+ criteria: "Denormalization trade-off is discussed — JSON is good for flexible, rarely-queried attributes; generated columns (STORED) + indexes for frequently-queried fields; full denormalization for high-performance needs. Discusses storage trade-off (STORED generated columns duplicate data) and when to keep JSON vs extract to regular columns"
86
+ weight: 0.30
87
+ description: "Denormalization trade-off"
@@ -0,0 +1,68 @@
1
+ meta:
2
+ id: lock-contention-analysis
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Analyze and resolve MySQL lock contention — understand InnoDB row locks, gap locks, deadlocks, and design lock-free patterns"
7
+ tags: [MySQL, InnoDB, locks, deadlock, gap-locks, contention, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your e-commerce platform is experiencing intermittent deadlocks and
13
+ lock wait timeouts during checkout. The error rate spikes during flash
14
+ sales when multiple customers try to purchase the same products
15
+ simultaneously.
16
+
17
+ Error logs show:
18
+ - Deadlock detected (InnoDB): 50/hour during flash sales
19
+ - Lock wait timeout exceeded: 200/hour during flash sales
20
+ - innodb_lock_wait_timeout = 50 (default)
21
+
22
+ The problematic flow (checkout):
23
+ Transaction 1 (Customer A):
24
+ BEGIN;
25
+ SELECT * FROM inventory WHERE product_id = 101 FOR UPDATE; -- X lock
26
+ UPDATE inventory SET quantity = quantity - 1 WHERE product_id = 101;
27
+ INSERT INTO order_items (order_id, product_id, quantity) VALUES (1, 101, 1);
28
+ UPDATE orders SET total = total + 29.99 WHERE id = 1; -- Deadlock here!
29
+ COMMIT;
30
+
31
+ Transaction 2 (Customer B, concurrent):
32
+ BEGIN;
33
+ SELECT * FROM inventory WHERE product_id = 101 FOR UPDATE; -- Waits for T1
34
+ -- or takes a different code path that locks orders first, then inventory
35
+
36
+ SHOW ENGINE INNODB STATUS reveals:
37
+ - Gap locks on inventory (product_id range) blocking other inserts
38
+ - Deadlock cycle: T1 holds X on inventory.101, wants X on orders.1
39
+ T2 holds X on orders.2, wants X on inventory.101
40
+ - Lock modes: X (exclusive), S (shared), X,GAP, X,REC_NOT_GAP
41
+
42
+ Additional lock issues:
43
+ 1. ALTER TABLE on orders (500M rows) takes AccessExclusive lock,
44
+ blocking all queries for 20 minutes during metadata operations
45
+ 2. Long-running analytics transaction (READ COMMITTED) prevents
46
+ InnoDB purge of old row versions, causing undo log growth
47
+ 3. Gap locks in REPEATABLE READ preventing concurrent inserts in
48
+ ranges even when no actual conflict exists
49
+
50
+ Task: Analyze and resolve the lock contention. Write: the deadlock
51
+ root cause analysis (why the circular dependency forms), the lock-free
52
+ checkout redesign, the gap lock explanation and mitigation, the
53
+ isolation level trade-offs (REPEATABLE READ vs READ COMMITTED), and
54
+ the monitoring strategy for lock issues.
55
+
56
+ assertions:
57
+ - type: llm_judge
58
+ criteria: "Deadlock analysis is correct — identifies the circular lock dependency (T1 locks inventory then orders, T2 locks orders then inventory), explains that consistent lock ordering would prevent the deadlock (always lock inventory first, then orders), and shows how to read SHOW ENGINE INNODB STATUS deadlock output"
59
+ weight: 0.35
60
+ description: "Deadlock analysis"
61
+ - type: llm_judge
62
+ criteria: "Lock-free redesign is practical — uses optimistic locking (version column), or UPDATE ... WHERE quantity >= 1 without SELECT FOR UPDATE, or queuing (serialize inventory updates through a queue), or advisory locking. Explains gap locks (prevent phantom rows in REPEATABLE READ by locking gaps between index records) and how READ COMMITTED eliminates gap locks"
63
+ weight: 0.35
64
+ description: "Lock-free redesign"
65
+ - type: llm_judge
66
+ criteria: "Isolation level trade-offs and monitoring are addressed — REPEATABLE READ (default): gap locks prevent phantoms but reduce concurrency; READ COMMITTED: no gap locks, higher concurrency, but allows phantom reads. Monitoring: performance_schema.data_locks, data_lock_waits, innodb_row_lock_waits status variable, and alerting on deadlock frequency"
67
+ weight: 0.30
68
+ description: "Isolation and monitoring"
@@ -0,0 +1,63 @@
1
+ meta:
2
+ id: monitoring-alerting
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Design MySQL monitoring and alerting — implement Percona PMM, define alert thresholds, and build performance dashboards"
7
+ tags: [MySQL, monitoring, PMM, alerting, dashboards, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your company has 15 MySQL servers and no unified monitoring. Last
13
+ month, a disk-full incident on the primary database caused 2 hours
14
+ of downtime — nobody noticed until customers reported errors. The
15
+ CTO mandates comprehensive monitoring by end of quarter.
16
+
17
+ Current state:
18
+ - 15 MySQL 8.0 instances (5 primaries, 10 replicas)
19
+ - No centralized monitoring (each team checks their own server)
20
+ - Basic CloudWatch metrics (CPU, disk, connections)
21
+ - No query-level visibility
22
+ - No alerting — issues discovered by customer complaints
23
+
24
+ Recent incidents that monitoring would have prevented:
25
+ 1. Disk full: WAL files + binlog accumulated, 100% disk, crash
26
+ 2. Replication lag: Replica fell 2 hours behind, stale data served
27
+ 3. Slow query regression: New deployment added query scanning 10M rows
28
+ 4. Connection exhaustion: max_connections hit during traffic spike
29
+ 5. Table bloat: 500GB table with 300GB dead rows (no optimize)
30
+
31
+ Monitoring stack options:
32
+ A. Percona PMM (open-source, MySQL-focused)
33
+ B. Datadog Database Monitoring (commercial, broad integration)
34
+ C. Prometheus + Grafana + mysqld_exporter (DIY)
35
+ D. CloudWatch Enhanced Monitoring (AWS-native)
36
+
37
+ Key metrics to monitor:
38
+ - Query performance: QPS, latency percentiles, slow query count
39
+ - Replication: lag, binlog position, I/O and SQL thread status
40
+ - InnoDB: buffer pool hit ratio, dirty pages, row lock waits
41
+ - Resources: CPU, memory, disk I/O, disk space, connections
42
+ - Schema: table sizes, index sizes, unused indexes, fragmentation
43
+
44
+ Task: Design the monitoring and alerting system. Write: the
45
+ recommended monitoring stack (with justification), the metric
46
+ categories and specific metrics to track, the alerting thresholds
47
+ (warning and critical for each metric), the dashboard design (what
48
+ each audience needs), and the incident detection that would have
49
+ caught the 5 past incidents.
50
+
51
+ assertions:
52
+ - type: llm_judge
53
+ criteria: "Monitoring stack is justified — recommends PMM or Prometheus+Grafana with clear reasoning (PMM: MySQL-specific dashboards out of box, query analytics, advisor checks; Prometheus+Grafana: more customizable, broader ecosystem; Datadog: best integration but expensive). Covers installation and configuration overview"
54
+ weight: 0.35
55
+ description: "Monitoring stack justified"
56
+ - type: llm_judge
57
+ criteria: "Alerting thresholds are specific — defines warning and critical thresholds for: disk usage (warning 80%, critical 90%), replication lag (warning 30s, critical 300s), buffer pool hit ratio (warning <95%, critical <90%), connections (warning 80% of max, critical 95%), slow queries (warning 2x baseline, critical 5x). Each threshold has a response action"
58
+ weight: 0.35
59
+ description: "Specific alerting thresholds"
60
+ - type: llm_judge
61
+ criteria: "Past incidents would be caught — maps each of the 5 incidents to specific metrics and thresholds: disk full (disk usage alert at 80%), replication lag (lag alert at 30s), slow query regression (query latency change detection), connection exhaustion (connections approaching max), table bloat (table size growth rate or InnoDB free space). Demonstrates the monitoring prevents future incidents"
62
+ weight: 0.30
63
+ description: "Past incidents prevented"
@@ -0,0 +1,79 @@
1
+ meta:
2
+ id: online-schema-changes
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Perform online schema changes — use pt-online-schema-change, gh-ost, and MySQL Online DDL to modify large tables without downtime"
7
+ tags: [MySQL, online-DDL, pt-osc, gh-ost, schema-change, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ You need to add a column and an index to a 500 million row table in
13
+ production without causing downtime. The last time someone ran ALTER
14
+ TABLE on this table, it blocked all queries for 45 minutes.
15
+
16
+ The change needed:
17
+ ALTER TABLE orders
18
+ ADD COLUMN shipping_method VARCHAR(50) DEFAULT 'standard',
19
+ ADD INDEX idx_shipping (shipping_method, created_at);
20
+
21
+ Table: orders (500M rows, 200GB, InnoDB)
22
+ - 50K queries/second during peak
23
+ - Used by checkout (cannot tolerate blocking)
24
+
25
+ MySQL Online DDL capabilities (8.0):
26
+ - ALGORITHM=INPLACE: restructures table in-place without full copy
27
+ - ALGORITHM=INSTANT: metadata-only change (fastest, very limited)
28
+ - LOCK=NONE: allows concurrent DML during DDL
29
+
30
+ What each DDL supports:
31
+ | Operation | INSTANT | INPLACE | COPY | Lock during |
32
+ |--------------------|---------|---------|-------|-------------|
33
+ | ADD COLUMN (last) | Yes | Yes | Yes | None |
34
+ | ADD COLUMN (middle)| No | Yes | Yes | None |
35
+ | ADD INDEX | No | Yes | Yes | None |
36
+ | DROP COLUMN | No* | Yes | Yes | None |
37
+ | CHANGE column type | No | No | Yes | Full lock |
38
+ | ADD FOREIGN KEY | No | Yes* | Yes | None* |
39
+
40
+ * With caveats
41
+
42
+ But even with ALGORITHM=INPLACE, the operation can:
43
+ 1. Take hours (rebuilds index in background)
44
+ 2. Consume massive disk space (temporary files)
45
+ 3. Cause replication lag (DDL replays as single operation on replica)
46
+ 4. Briefly acquire metadata lock at start and end (blocking if long
47
+ transactions are running)
48
+
49
+ External tools:
50
+ A. pt-online-schema-change (Percona Toolkit):
51
+ - Creates shadow table, copies data via triggers, atomic rename
52
+ - Throttles based on replica lag and server load
53
+ B. gh-ost (GitHub):
54
+ - Uses binlog streaming instead of triggers
55
+ - No trigger overhead, more controllable
56
+ - Can pause/resume migration
57
+ C. MySQL Online DDL (native):
58
+ - Built-in, no external tool
59
+ - More limited control, no throttling
60
+
61
+ Task: Design the schema change strategy. Write: which approach to
62
+ use for this change (and why), the execution plan (step by step), the
63
+ risk mitigation (what if it fails mid-way), the replication impact
64
+ and how to manage it, and the decision framework for choosing between
65
+ pt-osc, gh-ost, and native Online DDL.
66
+
67
+ assertions:
68
+ - type: llm_judge
69
+ criteria: "Tool recommendation is justified — recommends gh-ost or pt-osc for this change (despite native Online DDL support) because of controllability: throttling based on lag, ability to pause/resume, predictable disk usage. Explains that native INPLACE DDL works but can't be throttled and metadata lock acquisition can block queries if long transactions exist"
70
+ weight: 0.35
71
+ description: "Tool recommendation justified"
72
+ - type: llm_judge
73
+ criteria: "Execution plan is detailed — includes pre-checks (disk space for shadow table, no running long transactions, replica lag baseline), the migration command with throttling parameters, monitoring during migration (lag, disk, query latency), and the atomic cutover (rename tables). Estimates duration based on table size"
74
+ weight: 0.35
75
+ description: "Detailed execution plan"
76
+ - type: llm_judge
77
+ criteria: "Decision framework covers common cases — native Online DDL for: INSTANT-supported changes (add column at end), simple index additions on small tables. pt-osc for: trigger-compatible changes, MySQL 5.7. gh-ost for: large tables requiring throttling, trigger-sensitive environments, when pause/resume needed. All three compared on: speed, safety, controllability, replication impact"
78
+ weight: 0.30
79
+ description: "Decision framework"
@@ -0,0 +1,83 @@
1
+ meta:
2
+ id: partitioning-strategies
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Design MySQL partitioning — implement RANGE, LIST, HASH, and KEY partitioning with partition pruning for large table performance"
7
+ tags: [MySQL, partitioning, RANGE, LIST, HASH, partition-pruning, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your events table has grown to 2 billion rows (800GB) and queries
13
+ are slowing down despite proper indexing. The table receives 50K
14
+ inserts per second and most queries filter by date range. The DBA
15
+ team proposes partitioning but the engineers have concerns about
16
+ complexity.
17
+
18
+ Current table:
19
+ CREATE TABLE events (
20
+ id BIGINT AUTO_INCREMENT,
21
+ tenant_id INT NOT NULL,
22
+ event_type VARCHAR(50) NOT NULL,
23
+ payload JSON,
24
+ created_at DATETIME NOT NULL,
25
+ PRIMARY KEY (id),
26
+ INDEX idx_tenant_date (tenant_id, created_at),
27
+ INDEX idx_type_date (event_type, created_at)
28
+ ) ENGINE=InnoDB;
29
+
30
+ Query patterns:
31
+ 1. (80%) Recent events by tenant:
32
+ WHERE tenant_id = ? AND created_at >= NOW() - INTERVAL 7 DAY
33
+ 2. (15%) Events by type and date:
34
+ WHERE event_type = ? AND created_at BETWEEN ? AND ?
35
+ 3. (5%) Data cleanup:
36
+ DELETE FROM events WHERE created_at < NOW() - INTERVAL 90 DAY
37
+
38
+ Partitioning options considered:
39
+ A. RANGE by created_at (monthly partitions):
40
+ PARTITION BY RANGE (TO_DAYS(created_at)) (
41
+ PARTITION p202501 VALUES LESS THAN (TO_DAYS('2025-02-01')),
42
+ PARTITION p202502 VALUES LESS THAN (TO_DAYS('2025-03-01')),
43
+ ...
44
+ )
45
+
46
+ B. LIST by tenant_id:
47
+ PARTITION BY LIST (tenant_id) (
48
+ PARTITION p_small VALUES IN (1,2,3,...100),
49
+ PARTITION p_medium VALUES IN (101,102,...200),
50
+ ...
51
+ )
52
+
53
+ C. HASH by tenant_id:
54
+ PARTITION BY HASH (tenant_id) PARTITIONS 16;
55
+
56
+ D. Composite: RANGE by date, sub-partitioned by tenant (not supported
57
+ natively in MySQL — would need application-level sharding)
58
+
59
+ Constraints:
60
+ - PRIMARY KEY must include the partition key in MySQL
61
+ - This means changing PK from (id) to (id, created_at) for RANGE
62
+ - UNIQUE indexes must include the partition key
63
+ - Foreign keys not supported on partitioned tables
64
+
65
+ Task: Design the partitioning strategy. Write: the recommended
66
+ partitioning scheme with justification, the table DDL changes
67
+ (including PK modification), the partition pruning explanation (how
68
+ queries benefit), the maintenance plan (adding/dropping partitions),
69
+ and the data cleanup improvement (DROP PARTITION vs DELETE).
70
+
71
+ assertions:
72
+ - type: llm_judge
73
+ criteria: "RANGE partitioning by date is recommended — matches the dominant query pattern (80% filter by date range), enables partition pruning (queries touch only relevant monthly partitions instead of scanning 2B rows), and the 90-day cleanup becomes DROP PARTITION (instant) instead of DELETE (hours of I/O). Justifies why LIST/HASH are less optimal for this workload"
74
+ weight: 0.35
75
+ description: "RANGE partitioning justified"
76
+ - type: llm_judge
77
+ criteria: "PK modification is addressed — explains that MySQL requires partition key in the PK, so PK changes from (id) to (id, created_at). Discusses the impact: auto_increment still works but is now only unique per partition, UNIQUE constraints must include created_at, and foreign keys referencing this table need updates. Shows the DDL"
78
+ weight: 0.35
79
+ description: "PK modification addressed"
80
+ - type: llm_judge
81
+ criteria: "Maintenance plan is practical — includes automated partition creation (add new monthly partitions ahead of time via event scheduler or cron), partition pruning verification (EXPLAIN PARTITIONS shows which partitions are accessed), and data lifecycle management (DROP PARTITION for old data is instant vs DELETE which generates massive undo logs)"
82
+ weight: 0.30
83
+ description: "Practical maintenance plan"
@@ -0,0 +1,84 @@
1
+ meta:
2
+ id: query-profiling-deep-dive
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Deep-dive query profiling — use EXPLAIN ANALYZE, optimizer trace, and handler counters to understand exactly where query time is spent"
7
+ tags: [MySQL, profiling, EXPLAIN-ANALYZE, optimizer-trace, handler-counters, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ A critical API query takes 2 seconds but EXPLAIN estimates show it
13
+ should be fast (few rows, good indexes). You need to understand
14
+ exactly where the 2 seconds are spent — is it I/O, CPU, lock waits,
15
+ or something else entirely?
16
+
17
+ The query:
18
+ SELECT o.id, o.total, o.status,
19
+ c.name, c.email,
20
+ GROUP_CONCAT(oi.product_name ORDER BY oi.price DESC) AS products
21
+ FROM orders o
22
+ JOIN customers c ON c.id = o.customer_id
23
+ JOIN order_items oi ON oi.order_id = o.id
24
+ WHERE o.customer_id = 42
25
+ AND o.created_at >= '2025-01-01'
26
+ GROUP BY o.id
27
+ ORDER BY o.created_at DESC
28
+ LIMIT 10;
29
+
30
+ EXPLAIN shows good plans (all using indexes, few rows).
31
+ But actual execution: 2 seconds.
32
+
33
+ Profiling tools available:
34
+
35
+ 1. EXPLAIN ANALYZE (MySQL 8.0.18+):
36
+ Shows actual time spent at each step, not just estimates.
37
+
38
+ 2. Optimizer Trace:
39
+ SET optimizer_trace = 'enabled=on';
40
+ SELECT ...; -- your query
41
+ SELECT * FROM information_schema.optimizer_trace;
42
+ Shows every decision the optimizer made.
43
+
44
+ 3. Handler counters:
45
+ FLUSH STATUS;
46
+ SELECT ...; -- your query
47
+ SHOW STATUS LIKE 'Handler%';
48
+ Shows exact row-level operations (reads, writes, sorts).
49
+
50
+ 4. Performance Schema events:
51
+ SELECT * FROM events_stages_history
52
+ WHERE THREAD_ID = (current thread);
53
+ Shows time spent in each execution stage.
54
+
55
+ 5. Status counters:
56
+ SHOW STATUS LIKE 'Sort%';
57
+ SHOW STATUS LIKE 'Created_tmp%';
58
+ Shows temporary table and sort operations.
59
+
60
+ Your investigation reveals:
61
+ - Handler_read_next: 50,000 (reading 50K order_items)
62
+ - Created_tmp_disk_tables: 1 (GROUP_CONCAT overflow to disk)
63
+ - Sort_merge_passes: 5 (sorting on disk, not in memory)
64
+ - GROUP_CONCAT result for one order has 500+ items
65
+
66
+ Task: Write the query profiling guide. Include: how to use EXPLAIN
67
+ ANALYZE to find time bottlenecks, how to read optimizer trace output,
68
+ what handler counters reveal about row access patterns, how to
69
+ identify temporary table and sort issues, and the fix for this
70
+ specific query.
71
+
72
+ assertions:
73
+ - type: llm_judge
74
+ criteria: "EXPLAIN ANALYZE interpretation is explained — shows how to read the actual_time field (start_time...end_time), how actual_rows vs estimated rows reveals bad estimates, and identifies which iterator in the tree is consuming the most time. This is the primary tool for finding where 2 seconds is spent"
75
+ weight: 0.35
76
+ description: "EXPLAIN ANALYZE interpretation"
77
+ - type: llm_judge
78
+ criteria: "Handler counters and temporary tables are decoded — Handler_read_next=50K means 50K sequential reads (scanning through order_items), Created_tmp_disk_tables=1 means the temporary table overflowed to disk (likely GROUP_CONCAT result exceeding group_concat_max_len or tmp_table_size), and Sort_merge_passes=5 indicates sort didn't fit in sort_buffer_size"
79
+ weight: 0.35
80
+ description: "Counters decoded"
81
+ - type: llm_judge
82
+ criteria: "Fix for the specific query is provided — the GROUP_CONCAT on 500+ items per order is the bottleneck (overflows to disk temp table). Solutions: add LIMIT within GROUP_CONCAT (MySQL doesn't support it natively, so use a subquery), increase group_concat_max_len and tmp_table_size, or restructure to return order items separately instead of concatenating"
83
+ weight: 0.30
84
+ description: "Specific query fix"
@@ -0,0 +1,66 @@
1
+ meta:
2
+ id: replication-optimization
3
+ level: 3
4
+ course: mysql-query-optimization
5
+ type: output
6
+ description: "Optimize MySQL replication — tune source-replica lag, implement parallel replication, and design read scaling topology"
7
+ tags: [MySQL, replication, source-replica, parallel-replication, lag, advanced]
8
+
9
+ state: {}
10
+
11
+ trigger: |
12
+ Your MySQL replication is falling behind. The replica consistently
13
+ lags 30-60 seconds behind the source during peak hours, causing stale
14
+ reads in your read-heavy application. The analytics team's queries on
15
+ the replica further increase the lag.
16
+
17
+ Current topology:
18
+ - Source: MySQL 8.0, db.r6g.4xlarge (16 vCPU, 128GB)
19
+ - Replica 1: db.r6g.2xlarge (8 vCPU, 64GB) — application reads
20
+ - Replica 2: db.r6g.2xlarge (8 vCPU, 64GB) — analytics
21
+ - Binlog format: ROW
22
+ - replica_parallel_workers = 0 (single-threaded replay!)
23
+
24
+ Replication lag investigation:
25
+ SHOW REPLICA STATUS:
26
+ - Seconds_Behind_Source: 45
27
+ - Relay_Log_Space: 2GB (large backlog)
28
+ - Replica_SQL_Running_State: "Applying batch of row changes"
29
+
30
+ Source write patterns:
31
+ - 10K writes/second peak
32
+ - Large transactions: nightly ETL process writes 5M rows in one txn
33
+ - DDL operations: weekly ALTER TABLE on 100M-row table
34
+ - Binlog output: 500MB/hour
35
+
36
+ Issues:
37
+ 1. Single-threaded SQL applier can't keep up with multi-threaded source
38
+ 2. Large transactions block all other replication until complete
39
+ 3. Analytics queries on Replica 2 compete for CPU with SQL applier
40
+ 4. No parallel replication configured
41
+ 5. ROW format binlog is large (every changed column for every row)
42
+
43
+ MySQL 8.0 parallel replication options:
44
+ A. LOGICAL_CLOCK: parallel replay based on commit timestamps
45
+ B. DATABASE: parallel replay per database (limited if single database)
46
+ C. WRITESET: track row-level dependencies (most parallel, MySQL 8.0.14+)
47
+
48
+ Task: Design the replication optimization. Write: the parallel
49
+ replication configuration (which mode, how many workers), the large
50
+ transaction handling strategy, the replica sizing (match source
51
+ capacity), the binlog format trade-offs (ROW vs MIXED vs STATEMENT),
52
+ and the lag monitoring and alerting approach.
53
+
54
+ assertions:
55
+ - type: llm_judge
56
+ criteria: "Parallel replication is correctly configured — enables replica_parallel_workers=16 (matching source CPU), sets replica_parallel_type=LOGICAL_CLOCK or WRITESET for MySQL 8.0, explains why DATABASE mode doesn't help with single database, and notes that WRITESET provides the most parallelism by tracking row-level dependencies"
57
+ weight: 0.35
58
+ description: "Parallel replication configured"
59
+ - type: llm_judge
60
+ criteria: "Large transaction and sizing issues are addressed — recommends breaking large ETL transactions into smaller batches (50K rows per commit), explains that a single large transaction serializes all replication (blocks other workers), and recommends matching replica hardware to source (8 vCPU replica can't keep up with 16 vCPU source)"
61
+ weight: 0.35
62
+ description: "Large transactions and sizing"
63
+ - type: llm_judge
64
+ criteria: "Binlog format and monitoring are explained — ROW format: largest binlog but safest (deterministic), STATEMENT: smallest but non-deterministic risk, MIXED: auto-selects. Monitoring: Seconds_Behind_Source, Relay_Log_Space, performance_schema.replication_applier_status_by_worker for per-worker lag, and alerting when lag exceeds application tolerance (e.g., 10 seconds)"
65
+ weight: 0.30
66
+ description: "Binlog format and monitoring"