MulaiMulai sekarang secara gratis

EXPLAINing query behavior

Many times, queries have a different execution plan than you might expect. Earlier in the course, you ran a query to get all the December readings for air_temp in Coffee County for the regular report type FM-15. You used a CTE to limit it to the dates and then a select statement to filter the report types so it would be easy to shift timelines via the CTE. Let's look at an explanation of that statement.

Latihan ini adalah bagian dari kursus

Introduction to Redshift

Lihat Kursus

Petunjuk latihan

  • Run EXPLAIN on the entire statement.
  • Update the temp_reading condition to be between Nov 1st and 30th of 2023.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

-- Explain the entire statement
___ WITH temp_readings as (
    SELECT date,
           hourlydrybulbtemperature AS air_temp,
           report_type
      FROM public_intro_redshift.coffee_county_weather
     -- Set it to the proper dates in November 2023
     WHERE date BETWEEN ___ AND ___
)
 SELECT date,
       air_temp
  FROM temp_readings
 WHERE report_type = 'FM-15';
Edit dan Jalankan Kode