A Stitch In Time Saves Nine: Solving the N+1 Problem

Paul Jones (http://paul-m-jones.com/)
PHP
Location: E144
Average rating: *****
(5.00, 2 ratings)

When dealing with databases, developers frequently run into the N+1 problem, in which they populate domain objects via queries in loops. This causes terrible performance drags. There is a solution in plain PHP that makes the number of queries constant to increase performance overall. The talk shows typical PHP code involving the N+1 problem, then shows how to solve the problem in plain PHP (that is, without a framework or ORM), and includes editorializing about the origins of the N+1 problem in the developer mindset. Additionally, the talk shows a solution in PL/pgSQL for Postgres users.

Photo of Paul Jones

Paul Jones

http://paul-m-jones.com/

Paul is an internationally recognized PHP expert who has worked as everything from junior developer to VP of Engineering in all kinds of organizations (corporate, military, non-profit, educational, medical, and others). Paul’s latest open-source project is the Aura project for PHP 5.4. Among his other accomplishments, Paul is the lead developer of the Solar framework, the creator of the Savant template system, has authored a series of authoritative benchmarks on dynamic framework performance, and was a founding contributor to the Zend Framework (the DB, DB_Table, and View components). In a previous career, Paul was an intelligence operations specialist for the US Air Force, and enjoys punching 7.62mm holes at 400 meters.

Sponsors

For information on exhibition and sponsorship opportunities at the conference, contact Sharon Cordesse at (707) 827-7065 or scordesse@oreilly.com.

View a complete list of OSCON contacts