r/programminghorror • u/OldaLP1 • Feb 23 '26
SQL DB with 2241 tables
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.
View all comments
Show parent comment
1
u/DeGandalf Feb 27 '26
in case there is actually that much data that you also need something like this in the end take a look at what a bloom filter is. It's basically a data structure exactly for this usecase.
Edit: just realized you actually mean that there is actual data in that table, too, wtf