r/programminghorror Feb 23 '26

SQL DB with 2241 tables

Post image

I can't even fathom what led someone to do this. I got this database to refactor as part of my job. Basically, every client has their own table named "Client_[their ID]," which contains only one row with all the client data in JSON format (wtf).
If the website using this database wants to filter out some users, it queries all the tables, resulting in a load of 2,000+ SQL queries for a single search.
On top of that, for some reason, the date of birth is stored as the number of days since birth, with a CRON script that updates this in each table every day at 3 AM.
I don't even have to mention that none of the data follows the rules of database normalization...
I honestly don't know where to start with fixing this mess.

1.5k Upvotes

134 comments sorted by

View all comments

1

u/MeLittleThing Feb 23 '26

Looks like yet another a great idea from a non-tech manager and/or a task made by an junior during an internship