Live data from Hacker News

Squeeze the hell out of the system you have

blog.danslimmon.com

301–310 of 383 posts

Re: Squeeze the hell out of the system you have

#301

The bit on the database performance issues leads me to my hottest, flamiest take for new projects: - Design your application's hot path to never use joins. Storage is cheap, denormalize everything and update it all in a transaction. It's truly amazing how much faster everything is when you eliminate joins. For your ad-hoc queries you can replicate to another database for analytical purposes. On this note, I have mixe…

> index all columns

check out MariaDB "ColumnStore". it recently got merged into the upstream binary, and i started reading about it. ngl i was salivating a bit.

Re: Squeeze the hell out of the system you have

#302
post #249

Earlier quoted context omitted.

Joins are not inherently expensive, but they can lead to expensive queries. For example, say I want to find the 10 most recent users with a phone number as their primary contact method: SELECT … FROM User JOIN ContactMethod on ContactMethod.userId = User.id WHERE ContactMethod.priority = ‘primary’ AND ContactMethod.type = ‘phoneNumber’ ORDER BY User.createdAt DESC LIMIT 10 If there are a very large number of users, a…

For 10 million users + telephones, this takes 1ms. create table users ( id serial primary key not null, created_at timestamp not null default now() ); create table users_telephones ( user_id int references users(id) not null, is_primary boolean not null default true, telephone varchar not null ); insert into users select i, NOW() + (random() * (interval '90 days')) + '30 days' from generate_series(1, 10000000) i; ins…

Thanks for bothering to work it through, I was too lazy.

But, yeah, exactly. Everyone thinks they need to optimise the life out of this stuff at the beginning but the db can do a lot with normalised data and the appropriate indexes.

Side note - is_primary isn’t required in the partial index itself since they’ll all be “true” due to the where clause.

Re: Squeeze the hell out of the system you have

#303
post #272

Earlier quoted context omitted.

That seems weirdly convoluted. So you store two columns to represent the foreign key?

If you use a varchar as FK then you're definitely doing something wrong from beginning. OP was talking about getting the phone number under certain conditions, and a phone number column is a varchar.

I don’t think they ever did a lookup on phone number and even if you needed to, you would just index it and it’d be fast. You can even use things like tri-gram indexes to give you super fast partial phone number matching.

Re: Squeeze the hell out of the system you have

#304

The bit on the database performance issues leads me to my hottest, flamiest take for new projects: - Design your application's hot path to never use joins. Storage is cheap, denormalize everything and update it all in a transaction. It's truly amazing how much faster everything is when you eliminate joins. For your ad-hoc queries you can replicate to another database for analytical purposes. On this note, I have mixe…

That is a hot take... ;) But joins should never impact performance in a large way if they're on the same server and properly indexed. "It's truly amazing how much faster everything is when you eliminate joins" is just not true if you're using joins correctly. Sadly, many developers simply never bother to learn. On the other hand, having to write a piece of data to 20 different spots instead of 1 is going to be dramat…

9 out of 10 will fail before they need to scale

Re: Squeeze the hell out of the system you have

#306
post #240

Earlier quoted context omitted.

> Google's hallowed SRE system was developed by an engineer who had come up through the ranks of Navy nuclear power Wait, really? That makes _so much sense._ It also makes me upset that all of my attempts to sway other SRE orgs over to Nuclear Navy practices have been met with doubt. - ex nuke submariner

Amazing. Just looked it up. This document references the nuclear navy and civil nuclear power multiple times: https://sre.google/sre-book/lessons-learned/

I’ve read much of that book, but apparently not that far. Thanks for linking.

Re: Squeeze the hell out of the system you have

#307

Earlier quoted context omitted.

oh I always nust assumed Lotus Notes was just lesser Outlook. can you give examples - such has how did it capture why decisions were made - that sounds ... hard or just "someone wrote it down"

It was a low/nocode environment; anyone (with enough rights) could knock up a simple app with rules/workflows and share it with the company. It made collecting, distributing and organising information easy if you knew what you were doing. It also created complex monsters as it was both too easy and too hard to use. I liked it a lot; we moved from Notes to Exchange and Sharepoint back in the day and it was awful for e…

Oh.

I struggle with the value of low/no code vs learning to code and providing common libraries.

Re: Squeeze the hell out of the system you have

#308
post #267
post #257

Earlier quoted context omitted.

> I built a startup and paid little attention to perf for years 1-5, and finally in year 6 we started to get bitten by some perf issues in specific tables, and spent a few engineer-months optimizing. This screams of if I don’t see it it the problem doesn’t exist view of the world. How do you know it’s not a problem? Perhaps customers would have signed up if it as faster? The problem is also treating it in terms of bu…

A denormalized database model is considered bad desig to begin with, and has performance costs on its own. This is why the OP says this is a "hot take". :) Maybe there are situations where this actually helps, although the resulting datastructure to me looks more like a multi-key cache.

Thank you. I’ve been reading these comments and thinking I’m losing my mind.

Re: Squeeze the hell out of the system you have

#310

Squeeze what you've got, as hard as you can, then realize after squeezing for a while that if you squeezed here, here, and also... here, by changing how you think about a problem, suddenly you've got a lot left to get. I spent two or so months optimizing the crap out of a majestic monolith and went from under 2K RPS when the PM thought, and the team repeatedly reported, that everything had been squeezed as much as it…

Could you share what's the content/protocol of these requests? And what's the average payload size (for req and response each)?
Post reply on HN