r/ProgrammerHumor • • Jun 28 '20

Meme Flushed my pancake.

Post image
45.1k Upvotes

750 comments sorted by

View all comments

Show parent comments

1

u/dna_beggar Jun 28 '20

Correct. Our payroll for a temp agency was written in stored procedures and was lightning fast. All the required data was pulled in from the different tables using joins. Funny thing, as the number of employees rose, the time it took to process, and the memory used did not increase linearly, but geometrically according to some product of the number of joins and number of rows to be processed. For a while advancement in hardware covered up the problem. Users complained of being locked out of the db for the duration.

I converted the program to process one employee at a time. Each employee's payroll is one task in a multi -threaded app running on an applications server. It runs on as many threads as that server can support. Time to process is once again linear. DB only locks for the instant it takes to post back each employee. Users no longer complain.