Escaping the Nested SQL Query Hell: Building Movie Page Data with a Single Query

2025-09-05

This article discusses the challenges of building movie page data using relational databases. Traditional methods require multiple SQL queries to fetch information such as directors, actors, and genres, and manually assemble the results into the desired hierarchical structure, which is inefficient and prone to errors. The author uses functions such as `jsonb_agg` to directly generate JSON-formatted structured data in a single SQL query, effectively solving the "object-relational impedance mismatch" problem, improving efficiency, and avoiding multiple network requests and data inconsistencies. This demonstrates the evolution of SQL and the importance of adapting to new data needs.

Read more
Development

Zig vs. Rust: A Deep Dive into Memory Safety

2025-05-13

This article delves into a detailed comparison of Zig and Rust regarding memory safety. Rust, with its powerful compile-time proof system, virtually eliminates memory safety vulnerabilities. While Zig improves upon C with features like slice types and bounds checking, it remains susceptible to memory safety issues such as use-after-free and buffer overflows. The author uses personal experience and project data to demonstrate Rust's memory safety advantage in large projects, but also suggests Zig's potential use in specific scenarios, such as within Wasm sandboxes. Zig's future success may hinge on the development of inexpensive runtime mitigations.

Read more
Development

Clojure Accounting: Evolving from Script to Interactive Web App

2025-03-08

The author initially used a Clojure script for accounting, but as the number of transactions grew, maintenance and sharing became difficult. A simple script is easy to write but provides a poor user experience, while a complex web application offers a good experience but is expensive to develop. The author cleverly combined Clojure's features with a simple web application framework to create an interactive accounting system similar to a notebook. This system allows users to write Clojure code, view results in real-time, and modify accounting rules and data via simple UI elements. It also supports data persistence, version control, and collaborative editing, effectively addressing the shortcomings of the original script and improving user experience and efficiency.

Read more
Development

Post-Conference Retrospective: Lessons Learned from Running an Online Event

2025-03-06

This post details the author's experience running an online conference, highlighting improvements made since the previous event. Speaker recruitment, marketing, ticketing (using Stripe's pay-what-you-want feature), and video management were all addressed. While ticket sales were slightly lower than last year, attendee engagement and feedback were positive. Areas for improvement include refining speaker communication, optimizing marketing efforts, and enhancing video/audio quality. The author questions the overall efficiency of the process, suggesting future iterations might be structured differently.

Read more

10x Programmer: How to Dramatically Increase Your Coding Speed

2025-02-20

This post argues for the importance of improving coding speed. The author compares the development time of two similar libraries, six and two years apart, demonstrating at least a 5x, and potentially 20-30x speed increase. This improvement stems from clearer goals, faster design decisions, and improved work processes. The author suggests a potential 10x speedup is achievable by improving mechanical skills like typing speed, reducing bugs, and refining workflows. This translates to more output, broader project choices, and more learning opportunities. The post explores the impact on project selection, feedback loops, tool development, and uses SQLite's optimization as an example of how small, incremental improvements compound to significant gains. The author concludes that increased speed is also more enjoyable.

Read more
Development coding speed

Small but Mighty: Redefining Success in the Software Industry

2025-02-18

This article explores how small software companies can thrive against tech giants. The author highlights examples like SQLite, Hwaci, Pinboard, Tarsnap, Sublime Text, and Zig, showcasing their success despite their small size. These companies prioritize high-quality products, unique business models, and customer focus for long-term sustainability. They reject Silicon Valley's 'grow or die' mentality, opting for a more sustainable and fulfilling definition of success. Their human-centric approach fosters strong customer relationships. The author argues that this 'small but mighty' model isn't about lacking ambition, but choosing a different path to success.

Read more

To Compile or Not to Compile Database Queries: A Deep Dive

2025-02-12

This article explores the trade-offs of compiling database queries. Traditional query interpreters struggle with the speed of modern NVMe SSDs, leading to significant performance bottlenecks. Compiling queries offers substantial speed improvements, especially for OLAP workloads. However, compilation time and optimization challenges create unpredictable performance cliffs. Vectorized interpreters, conversely, are easier to build, debug, and offer more consistent performance. The article contrasts this with browser JavaScript/Wasm engines, which use a tiered compilation approach (interpreter, baseline compiler, optimizing compiler) to achieve a smooth performance trade-off. The author proposes a similar approach for databases, suggesting a baseline compiler as a key component. Several implementation strategies, including 'copy-and-patch' and Wasm compilation, are explored. Ultimately, the article argues that building a baseline compiler isn't prohibitively difficult and offers perspectives on future directions.

Read more
Development query optimization