Hacker News new | ask | show | jobs
by compton93 1497 days ago
I hate to imagine how many startups out there don't even create indexes and just consider it to be a database problem and increase CPU/RAM and look the other way.

I worked for several years at a semi-startup as a Database Engineer where my role was to guide developers in writing performant SQL (and writing indexes for them) and architect their schema to be inline with our future plans and various other database tasks (managing query plans, being an expert on the database feature set etc). I even created an internal course: SQL School, that I included the directors/customer support teams in.

To that specific company my role was priceless, new features could be built in 1/2 the time with an expert writing the queries and handling the database. My programmatic analysis of our 20 year old code base had 5000 unique queries and 3000 more when accounting for dynamic SQL. Not gonna lie it was a complete mess but if I didn't exist they would have needed a lot more database resources. It was a terrible code base and any plan to refactor and avoid this mess would still need my role to do the transition.

I loved that job but its extremely hard to transition to any other roles and nowadays its easier to use alternative solutions.

3 comments

> hate to imagine how many startups out there don't even create indexes and just consider it to be a database problem and increase CPU/RAM

I've worked for a few of those fairly recently. I also worked for a place that was running on a fully custom codebase, no framework, php with all sql scattered through each page and all the devs using their individual machines to ssh into a central dev computer to work (tell people which file you're working on first). No version control of course.

> No version control of course.

This is an automatic fail for an employer. In interviews I ask, if it comes up I interrupt the discussion, verify, and if they truly develop without valid source control/revision control - I end the interview and inform the recruiter NFW and why.

I'm not saying I don't use version control. The company I worked at 14 years ago wasn't using version control. They are now.
> don't even create indexes and just consider it to be a database problem

is this DBA stuff though? Sounds like creating indexes would be basic junior-level backend dev knowledge?

> is this DBA stuff though?

Yes, it is or should be.

If you have a mission critical database with a lot of writing to it and the requirement of millisecond response times then every index you implement needs to be balanced against the cost of writing.

Like other database objects, i.e. constraints and triggers that's absolutely a DBA job.

You would think! But during my years as a cloud consultant I was parachuted into a problem project. I observed a large well paid team doing weird shit like archiving all their data to keep their database fast.

The database was 10gb RDS with no indexes.

It’s interesting that nobody there thinks: “There are much larger companies out there not archiving their data every month, what solution are they using?”
thing is, if you google for it, you will find it as a technique https://docs.oracle.com/database/121/VLDBG/GUID-5A76B6CE-C96... which I can imagine is used to justify the path they were on.

and we must note that the business side did eventually bring in external consultants because the project was clearly distressed. So it did eventually get corrected and I naturally tend to see the worse examples of this kind of thing, but yeah, it is possible to assemble a team of 8 developers and get unlucky such that not a single one knows anything about indexes or cloud databases in general.

I think it’s ridiculous since I come from an era where it was considered basic knowledge. I can’t imagine a software engineer that doesn’t have a passing familiarity with the goals of indexes (even if they don’t know exactly how they work).

But that’s turning out to be more and more untrue. Newer engineers really do not know.

My experience is that almost any startup needs to write some complex SQL and has to deal with slow query performance, so at least one or two engineers tend to be good at SQL/databases/query plans/indexing/etc. They may not be as knowledgeable or useful as a full dedicated Database Engineer/DBA, but at least you have indices/someone who enjoys writing SQL/someone who thinks about query performance.
Or they don't and then conclude that SQL and relational DBMSs are crap and that they have to switch to NoSQL to save the day (/s but only slightly)