Notes/LQO

LQO Finds Faster Plans for 35 of 94 Join Order Benchmark Query Shapes

LQO 0.1.0 has now run the Join Order Benchmark, the standard test for query optimizers: 113 queries over the IMDB movie database, which fold into 94 query shapes. It ran on a 4-core GitHub runner with PostgreSQL 16, each shape tried under the default plan and LQO’s 13 planner settings.

The results: 35 shapes got a suggestion and 59 stayed on the default plan. Where LQO suggested something, it saved 21% to 98%, median 48%, and one pass over every tested query went from 172.6 seconds to 77.6. One query, JOB 26c, did most of that, 59.2 seconds down to 1.2 with parallel workers off; without it the pass still drops by a third. No single setting won: switching off nested loops, hash joins, index scans, memoize and parallel workers each fixed different queries.