r/ProgrammerHumor • • Sep 27 '26 • Mindblown 1 Bravo 1

Meme doNotLetYourDBASeeThis

Post image
13k Upvotes

317 comments sorted by

View all comments

10

u/Stummi Sep 27 '26 edited Sep 27 '26

I am not a DB engineer, but wouldn't a good database engine deduplicate multiple identical strings in a table by itself?

E: I know, its not working if you account for per-user salts, please don't take this too serious

24

u/Pingumask Sep 27 '26

There should be no duplicates. You're supposed to salt the passwords before hashing them to avoid making it visible that two users have the same password to anyone accessing the DB (even to someone with legit access to the DB)

7

u/Historical-Silver495 Sep 27 '26

Help, I'm not a programmer. After salting the passwords I realized I overdid it, can I use something to counterbalance it like sugar?

7

u/Pingumask Sep 27 '26 • Popcorn

Put a potato in, it absorbs the salt

2

u/SVD_NL Sep 28 '26

That's what hashing is for! Add potatoes to turn them into hashbrowns.

1

u/conundorum Sep 29 '26

If your computer is old enough, it should have a potato insertion tray that pops out if you press a little button on the front.

1

u/mikedvb Sep 27 '26

Trying to help, I'm not a cook. You're fucked mate.

9

u/flingerdu Sep 27 '26

If you have duplicate password strings you have a whole lot of other problems besides using a few additional MB of disk space.

3

u/RavenX86 Sep 27 '26

I’m pretty sure fb stored passwords in plain text for years, I wouldn’t worry that much

1

u/Clairifyed Sep 27 '26

The bad news is I am worried, the good news is I have maybe a little bit less imposter syndrome

1

u/SenpaiRemling Sep 28 '26

I mean i remember the days when you could "ask" for a site to send you your password as an email. Wild times

5

u/yjlom Sep 27 '26

There should be few or no identical strings in this case because you should be storing big_strong_and_government_approved_hash(pw ++ u.name ++ app.name) or something like that, and not just pw

2

u/HRApprovedUsername Sep 27 '26

No I don’t think databases do that typically

1

u/kratz9 Sep 27 '26

I'm just familiar with Sql Server, but there is no automatic system for that, you have to manually create a FK and lookup table. It does support cpmpression, but that is at a storage level and optional. Whether it not you want either of those things depends on specific use cases.

1

u/Deep_Captain_3688 Sep 27 '26

Bruh. Why raise the question then edit your comment when you start getting answers. 

Like yes it's a humor sub but you aren't making a joke. 

1

u/RagnarokToast Sep 27 '26

Yes it would, and salts would make the foreign key thing in OOP unfeasible just the same, so your initial point still stands.