Whiteboard Coding: Using Hash Tables to Reduce Algorithm Time Complexity by Tracking State

Overview A hash table can reduce the time complexity of an algorithm by tracking state of input elements. In this post, I will explain the gist of the problems and how a hash table improves a naive solution. Problem #1 Description There is a large 2D array of arbitrary object type with length m and … Continue reading Whiteboard Coding: Using Hash Tables to Reduce Algorithm Time Complexity by Tracking State

Optimizing Redshift SQL Queries Via Query Plan Estimates

Using SQL queries to generate reports across several days can take a non-trivial amount of time. While it is tempting to simply throw more hardware at the problem, it does little to address the potential problem of inefficient queries. Inefficient queries are precursors to their final production ready counterparts, similar to developing software whereby the … Continue reading Optimizing Redshift SQL Queries Via Query Plan Estimates

Query Optimization – Processing 660 Million Rows Twice as Fast

I was recently given the opportunity to optimize a query that processed a total of 660 million rows. The problem with this query was that it took 150 minutes to complete, provided that it did not time out (which it did ~40% of the time). The query timing out caused two key problems, namely: 1) … Continue reading Query Optimization – Processing 660 Million Rows Twice as Fast