←︎ Back to selected work

Justworks

Worked inside an established Rails/PostgreSQL payroll product to bring expensive forecasting operations down from minutes to seconds.

PerformancePostgreSQLRailsData cleanup
Justworks product screenshot
Justworks
5-10+ minbefore optimization
secondsafter optimization
~60→︎120 GBdatabase growth during engagement
01 / Context

What I walked into

I joined an existing payroll/forecasting codebase where routine forecast operations could take five to ten minutes or longer. The database was growing quickly and data/model conventions around polymorphic associations had drifted over time.

02 / Engineering problem

What had to be solved

Improve response time without treating the symptom as a single slow query. The work crossed production data, associations, schema behavior, application code and tests in a large codebase.

THE WORK I OWNED

01

Worked on query and schema-related optimization around payroll forecasting and related payroll flows.

02

Corrected production polymorphic association data where model names had been stored inconsistently, and updated application code to follow the corrected conventions.

03

Participated in team design discussions around changing the payroll/invoice association from one-to-many to many-to-many so historical invoices could be reused correctly in later payrolls.

04

Handled the broad application/test impact of small association changes, where one data-model change could touch more than a hundred files.

05

Fixed affected unit tests and documented remaining data-cleanup work for the next developer during handoff.

HOW THE PIECES CONNECT

01Rails application
02Payroll domain
03PostgreSQL
04Sidekiq
05Polymorphic associations
06Forecasting queries
Outcome

The forecasting/page operation that had taken five to ten minutes or more was brought down to seconds after the optimization and data-association cleanup work.

RubyRuby on RailsPostgreSQLSidekiqRSpec
Next case studyUK DfE NPQ↗︎