‹ Jack's Brain

I Love Building Queries

Jul 18, 2014

At work, we’ve been going hard on building some reports while working with a particularly difficult database that ignores more normal forms than it follows. While my coworkers have found this frustrating, I quite enjoy it. Most of the code for previous reports has been handled entirely in PHP, with database queries getting all the relevant (and irrelevant) data, and looping through massive volumes in PHP (O(n^3+)). In my report, I’ve been working to offload all the processing to the SQL server, which has far more power than our web servers. I love solving the web of joins and sub tables. It’s essentially spacial perception – I visualize the tables and keys as blocks in space with specific connectors (the keys). Interestingly, I’ve never been terribly good at spacial perception – my teachers in pre-kindergarten in New Zealand would make me come to school early and do puzzles, which I despised, partly because it was hard, and partly because it took so long to slow down and think about (if you know me, you’re of course _shocked _that I didn’t enjoy a task that I wasn’t good at and forced me to slow down). The practice paid off though, and while I still have to think hard about 3D nets and folding, my 2D visualizations of SQL databases are a fun challenge.