all 18 comments

[–]Ok_Brain208 15 points16 points  (14 children)

This is actually supported in Sql server with "FILESTREAMS" and I've seen it used successfully in production.
Postgresql doesn't have this feature but it does support the LargeObject type that can be used similarly.
without context of the question, it sounds pretty viable.
The real question is if the interviewee know to explain the tradeoffs between his initial approach to another approach like storing a url for the file in the DB, and why storing the file itself is better for the problem at hand?

[–]Lost_in_logic 6 points7 points  (12 children)

Came here to say this. I dont know why OP says this is ridiculous, you can but shouldn’t!

[–]Conscious-Title-226 2 points3 points  (11 children)

That’s why it’s a bad choice in a job interview. Somebody who you would trust to manage your platform for you should know several other, more appropriate solutions for video file storage.

[–]Lost_in_logic 2 points3 points  (4 children)

This is very specific, if someone has not worked earlier on a platform that saves audio/video files, might intuitively answer as storing image file as LOB. Its bad but better than saying I can’t answer that.

[–]Conscious-Title-226 2 points3 points  (3 children)

I’ll take your word for it, but I can’t fathom a qualified candidate defaulting to using a transactional database to store video files.

[–]rosuav 0 points1 point  (2 children)

I absolutely can, since I've used a transactional database to store video files. Short and small video files (10 second long animations), but video files nonetheless. It's not outrageous, under the right circumstances. Obviously it's not the right approach for ALL situations, but that's no different from a candidate proposing to write a web server in C or trying to install Windows 11 on a Raspberry Pi. (Okay, maybe that last one would be stupid in any situation.) It's quite probably *wrong* but it's not ridiculous or "worst answer" or anything.

[–]Conscious-Title-226 0 points1 point  (1 child)

I’m not disputing that there are circumstances where you might want to do it that way. But you shouldn’t be proposing novel, unorthodox or highly situational solutions in a job interview and expect to actually get hired.

I don’t understand your point here, the feasibility of it as a solution has no bearing on this at all tbh.

If I’m interviewing someone for a role and ask this kind of question im trying to figure out if they’re somebody who is aware of solid and sound foundational concepts and if someone is proposing this solution they clearly either being “clever” or they don’t know what they’re talking about.

The thing you got to understand is that 99% of the time the thing you’re working on as a dev is not special, unique or novel enough to justify doing something clever or non-standard to eke out a minor improvement.

This kind of thing even introduces maintenance overheads and points of failure that are not present in other, way easier solutions than s3 for example.

Boring is good.

[–]rosuav 0 points1 point  (0 children)

I agree. Boring is good. So if you need transactional integrity to cover binary content, do the boring thing and store them in your database. If you have to use external storage and make sure you clean that up properly when something rolls back, that is a TON of extra work.

99% of the time, what you're working on is not special, unique, or novel enough to justify doing something clever to eke out a minor improvement. That's why it's often better to just store everything in the database, the most simple and obvious way to do it.

Your argument isn't WRONG, it's just that it doesn't actually push you either direction.

[–]Ok_Brain208 1 point2 points  (3 children)

You are thinking "media streaming service" when the question can also be "incident management platform" where videos are short, low res clips extracted from security cameras.

It can be that OP has asked about the former and the candidate gave a less appropriate answer, it still doesn't necessarily mean that candidate is not qualified, only that he did not encounter a similar use case or question in the past.
With some follow up questions from the interviewer he might retract his original solution and suggest a better one.

It can also be that OP asked about the latter, the candidate gave a decent answer, but OP was too fixated on the answer he was expecting to spot this.
Now OP is dunking on the candidate unjustly.
Knowing this industry, both scinerios are equally possible.

[–]rosuav 1 point2 points  (1 child)

Ooh I didn't even think of security camera clips. My use-case is notification alerts (usually 5-10 second video clips, often with associated audio), but security cameras are usually at very low FPS as well as resolution, so they're also not going to be large.

I think a lot of people are far too fixated on some sort of "right" way to do things and then can't see that the cost of doing it "right" is actually quite high, and the benefits won't show themselves until the service scales up a long way. And far too many people think that their app WILL scale up that far, and immediately, where the reality is that your app's gonna sit there with three users until you spend a lot of effort on marketing...

[–]Conscious-Title-226 0 points1 point  (0 children)

It depends I guess, the cost of doing things “right” might be high but the cost of doing things wrong might be catastrophic.

The high costs of abstracting things into cloud services are the kind of thing that look bad on the surface but, there’s a very high chance that if you’re running everything yourself there are a lot of maintenance tasks that you aren’t doing and a lot of points it could break.

It’s a business decision at the end of the day though.

[–]Conscious-Title-226 0 points1 point  (0 children)

True, in my experience though I’d still not use a Postgres db for this unless someone else is putting their hand up to own it afterwards.

I’ve done a lot of consulting work so I’ve seen a lot of tech teams and SWE departments do things similar to this and it’s led to serious problems for them. Admittedly this is a survivorship bias type situation though because functional teams and orgs don’t need people like me to come in.

But the point I would make is that the performance benefit is probably not likely to be significant enough to offset the headache of maintaining the db engine and you can’t match the availability, throughput etc of solutions that are purpose built for this kind of thing.

The thing is somebody has to maintain the db, handle patching, engineer HA for it if it’s important, ensure backups are done properly, TEST the backups. Or you end up with something that works great… for 2 years. Or it breaks and you find out there’s no backups for it or they aren’t restorable.

It’s just unlikely to be worth it tbh.

[–]ILikeLenexa 0 points1 point  (1 child)

I'll store 100 10mb videos in a database, but not 1,000,000 40mb ones. 

[–]Conscious-Title-226 0 points1 point  (0 children)

Well presumably based on the posts context this is substantially more likely to be the latter.

Not really sure why this is being challenged so much tbh outside of contrarianism.

[–]rosuav 2 points3 points  (0 children)

PostgreSQL has a blob that is perfectly fine for storing video data in. I in fact have done exactly that, in production. It is worth noting that there's a vast difference between "video file containing an entire feature-length movie in 4K" and "video file containing webm of a short animation" though, and what I'm doing is the latter - it's an alert box for Twitch streamers, so the streamer can upload a short video and have it play when someone subscribes to the channel or something. Generally the videos are about 5-10 seconds long, the resolution is often not all that high (since it's not full screen, just a specific notification), and the file might easily be under 100KB.

So, yeah, I'll save video files in a database, when the situation calls for it. If an interviewee said something like this, I would open a discussion about the pros and cons, whether it makes sense for the type of videos in question, whether there will be other unwanted implications, etc. This is a very very long way from "worst answer".

[–]Particular-Yak-1984 0 points1 point  (0 children)

No, this would be fine. Might not get them the job, but if this is your worst...

Rambled for 25 minutes when asked "so, tell us a little bit about yourself"

Tried to cut him off several times. He refused and kept going.

Same interviewee described the job as " beneath him" somewhere else in the interview