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.
This exercise is part of the course
Improving Query Performance in PostgreSQL
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
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;