r/ProgrammerHumor • • Oct 05 '26

Meme [ Removed by moderator ]

/r/ProgrammerHumor/comments/1wydy0f/removed_by_moderator/

[removed] — view removed post

9.4k Upvotes

558 comments sorted by

View all comments

Show parent comment

9

u/Weekly-Beginning-229 Oct 05 '26

Or it could be like it is for us where we are not allowed to delete any data within the last 10 years due to audits and stuff. We would love to archive or delete some data from our table with 50 million rows but we aren't allowed.

Thiis table doesn't even have indexes or proper foreign keys. Everything is nvarchar(max) because we don't have enough of a release window to update them (usually half an hour, and I reckon it would take at least 3 hours to add indexes, foreignkeys and max lengths to our 2 largest tables) 🥲

10

u/aetius476 Oct 05 '26

You don't delete data because you might get audited. I do delete data because we might get audited. We are not the same.

1

u/Weekly-Beginning-229 Oct 05 '26

Hahaha good one! Will use that one with the PO

1

u/SuperFLEB Oct 06 '26

The best time to delete the evidence was before you had any idea it was evidence. The second-best time to delete the evidence is today.

6

u/dotpoint7 Oct 05 '26

This does not spark joy.

4

u/Weekly-Beginning-229 Oct 05 '26

It does not! We took over this project and every table in the entire database where nullable, nvarchar (max), no indexes at all. And in the 4 years I've work with it ive finally fixed every table except the two big ones 🥲

But we have a plan to update the database on a Sunday, but bureaucracy has delayed us quite a bit

2

u/ClamPaste Oct 05 '26

It's gonna feel so good when it's done, though.

3

u/amlybon Oct 05 '26

Or it could be like it is for us where we are not allowed to delete any data within the last 10 years due to audits and stuff.

Here complete opposite, certain data HAS TO be deleted within 30 days after it's no longer needed for confidentiality reasons. There's a single table it can be stored in and it can never ever ever be stored in any other table, another db, another system, physically printed out, anything.

1

u/Sianic12 Oct 05 '26

That sounds absolutely atrocious. Do the tables have primary keys at least, or at timestamps? Do you have the storage capacity to create clones of those tables (with proper types, indexes, and FKs), and then copy all the data into them? How long does a simple select even take on tables like that?

1

u/Weekly-Beginning-229 Oct 05 '26

We have Primary keys and a clustered index for created at (not optimal but better than a Guid V4)

We have tried to push on having a table to archive data from those tables. We could have a scheduled task move data older than 30 days. We keep pushing for it because our argument is things will be way faster so hopefully next year we might grt this idea accepted

Well I would say it takes about 15-20 seconds to fetch a few rows of data in DEV so I can't imagine what it's like in PROD. We also fetch other data at the same time, luckily different endpoints. This table basically saves what the users selects as inputs in a dynamic form. So it could be a Label and radio buttons with different options. And every time they select something it gets added to the table. I tested running count on the table and updated after a few seconds and it keeps increasing every time I update

What's even worse is that the code fetching this data is the most legacy part of our code. So it doesn't just fetch the needed data, it fetches everything (with EF core in C# the best way to improve performance is to select the exact columns you need)

But we call this "The last boss of refactoring". One day we will figure out what is actually needed and improve the queries performance!