Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Diagnosing a Slow Payment Query | Real-World Query Optimization Scenarios
Mastering SQL EXPLAIN and Query Planning

bookChallenge: Diagnosing a Slow Payment Query

Tâche

Swipe to start coding

You are asked to diagnose and optimize a slow query that retrieves payment records for paid rides, joining the payments and riders tables. Use the EXPLAIN output to identify the bottleneck and optimize the query for better performance.

  • Analyze the query using EXPLAIN to observe the current execution plan.
  • Identify the cause of the slow performance, focusing on sequential scans or inefficient joins.
  • Add an index to the payments table to improve filtering and ordering by status and payment_time.
  • Verify the optimization by running EXPLAIN on the query again.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Diagnosing a Slow Payment Query

Glissez pour afficher le menu

Tâche

Swipe to start coding

You are asked to diagnose and optimize a slow query that retrieves payment records for paid rides, joining the payments and riders tables. Use the EXPLAIN output to identify the bottleneck and optimize the query for better performance.

  • Analyze the query using EXPLAIN to observe the current execution plan.
  • Identify the cause of the slow performance, focusing on sequential scans or inefficient joins.
  • Add an index to the payments table to improve filtering and ordering by status and payment_time.
  • Verify the optimization by running EXPLAIN on the query again.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 3. Chapitre 4
single

single

some-alt