CST363 • Week 4
← Back to all postsSELECT * FROM Semester WHERE Progress = 50%
September 27, 2026
This week was definitely one of the more mentally challenging weeks of the class so far because we had our midterm, which also means we are somehow already halfway through the course. That is kind of wild to think about considering how much we have covered already. I spent a lot of time reviewing joins, subqueries, aggregation, GROUP BY, and HAVING, and putting together my notes for the midterm helped reinforce some of the areas that I still have to think through more carefully.
After the midterm, this week's material shifted more toward understanding what the database is actually doing behind the scenes. In Lab 7, I got to experiment with B-tree and hash indexes and use EXPLAIN to see how they changed PostgreSQL's query plans. It was cool seeing a query switch from a sequential scan to an index scan after adding an index instead of just reading about why indexes can make queries faster.
The part that surprised me most was seeing that creating an index does not necessarily mean PostgreSQL will use it. When I added an index to the order date column, PostgreSQL still chose a sequential scan because the query returned more than half of the table. The same thing happened with the larger join after adding indexes to the foreign keys. PostgreSQL continued using hash joins and sequential scans because the optimizer determined that was still the better plan for the data.
Overall, between studying for the midterm and working through the indexing lab, this week felt like a good checkpoint for the class. I feel a lot more comfortable with the SQL we have learned in the first half, and now I am starting to understand more about how PostgreSQL decides how to actually execute those queries.
Comments
Join the conversation for this post.
No comments yet. Be the first to comment.