Aan de slagGa gratis aan de slag

Compare runtimes

Hawaii is home to many volcanoes. One volcano, Kīlauea has been erupting nearly continuously since 1983. The spewing volcanic smog (vog) is high in sulfur dioxide (SO2) and results in poor air quality. In fact, based on the count of good or moderate air quality days over 10 years (2008 to 2018), Hawaii has the worst air quality of any state.

In this exercise, you will look at the main air pollutant on poor air quality days, focusing on SO2 . You will compare the cost estimate between a query with an index on the pollutant column and a query without an index.

Deze oefening maakt deel uit van de cursus

Improving Query Performance in PostgreSQL

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

SELECT category
  , COUNT(*) as record_cnt
  , SUM(no_sites) as aqi_monitoring_site_cnt
FROM daily_aqi
___ ___ <> 'Good'
___ state_code = 15 -- Filter to Hawaii
GROUP BY category;
Code bewerken en uitvoeren