putting the grain first is exactly what i wish more plans opened with.
one line like 'one row = one order line' at the top probably settles more fights than another null scan. what worked for a teammate was forcing that sentence into the PR description before anyone looked at the seven checks. then sitting a few rows at that grain next to the total made the quiet join blowups obvious. i'll check your video on the inflated sum, that failure mode is the one i keep underestimating.
Putting it in the PR description is a smart forcing function, because it's the one place nobody skips. I'm stealing that. The same line works as a UAT entry criterion: no grain sentence, no testing starts. Hope the video is useful, and tell me if the fan-out example looks like the blowups you've seen.
Making the grain sentence a hard entry gate is sharper than leaving it as advice.
We tried the soft version first and people still skipped it under deadline. Once testing could not start without that one line in the PR, the fan-out cases showed up earlier, usually as an order-line total that quietly matched invoice count. Your video's blowup shape is the same one we keep walking into.
That one's nasty because it looks like a pass. refaeldakar posted a cheap alarm for exactly this on emadaed's fan-out post: next to the total, print count(*) and count(DISTINCT order_id) for the same rows. If they differ, the grain is order line no matter what the PR says. Two numbers, and nobody has to argue about it.
That's what I like about it: nobody has to win the argument about grain, the two numbers settle it. I'd put both in the sign-off record too, so the next person who touches the query can see what the grain was on the day it passed.
Yeah, putting both counts in the sign-off record makes it much easier for the next person to check.
I’d still probably want to keep the query version alongside them though. Then someone can rerun it and see whether a new join changed the grain, rather than trying to work backwards from a note that just says “order line.”
Agreed, a note on its own goes stale. I'd store the query file's commit hash next to the two counts in the sign-off record. The next person reruns that exact version, and if the counts drift, a diff of the query shows whether the join changed or the data did.
Storing the commit hash next to the counts is a clean way to pin the version.
I'd also keep a copy of the query text in the same record, or a link to that exact blob. The hash is exact, but if the file is renamed or the history is rewritten, the next person still needs a way to reopen it.
Good point on renames. I'd save the GitHub link to the file at that exact commit (the /blob/<hash>/ URL), since it still opens after the file moves on main. And I'd paste the query text itself into the sign-off record too, because a rewritten history can take the commit with it.
We're a place where coders share, stay up-to-date and grow their careers.
putting the grain first is exactly what i wish more plans opened with.
one line like 'one row = one order line' at the top probably settles more fights than another null scan. what worked for a teammate was forcing that sentence into the PR description before anyone looked at the seven checks. then sitting a few rows at that grain next to the total made the quiet join blowups obvious. i'll check your video on the inflated sum, that failure mode is the one i keep underestimating.
Putting it in the PR description is a smart forcing function, because it's the one place nobody skips. I'm stealing that. The same line works as a UAT entry criterion: no grain sentence, no testing starts. Hope the video is useful, and tell me if the fan-out example looks like the blowups you've seen.
Making the grain sentence a hard entry gate is sharper than leaving it as advice.
We tried the soft version first and people still skipped it under deadline. Once testing could not start without that one line in the PR, the fan-out cases showed up earlier, usually as an order-line total that quietly matched invoice count. Your video's blowup shape is the same one we keep walking into.
That one's nasty because it looks like a pass. refaeldakar posted a cheap alarm for exactly this on emadaed's fan-out post: next to the total, print count(*) and count(DISTINCT order_id) for the same rows. If they differ, the grain is order line no matter what the PR says. Two numbers, and nobody has to argue about it.
Printing both counts next to the total is a neat alarm.
If they differ, the grain is order line no matter what the PR title says. Two numbers end the argument faster than another meeting.
That's what I like about it: nobody has to win the argument about grain, the two numbers settle it. I'd put both in the sign-off record too, so the next person who touches the query can see what the grain was on the day it passed.
Yeah, putting both counts in the sign-off record makes it much easier for the next person to check.
I’d still probably want to keep the query version alongside them though. Then someone can rerun it and see whether a new join changed the grain, rather than trying to work backwards from a note that just says “order line.”
Agreed, a note on its own goes stale. I'd store the query file's commit hash next to the two counts in the sign-off record. The next person reruns that exact version, and if the counts drift, a diff of the query shows whether the join changed or the data did.
Storing the commit hash next to the counts is a clean way to pin the version.
I'd also keep a copy of the query text in the same record, or a link to that exact blob. The hash is exact, but if the file is renamed or the history is rewritten, the next person still needs a way to reopen it.
Good point on renames. I'd save the GitHub link to the file at that exact commit (the /blob/<hash>/ URL), since it still opens after the file moves on main. And I'd paste the query text itself into the sign-off record too, because a rewritten history can take the commit with it.