I use the following scheme:
1 - exhausted
0 - alive
-1 - blocked (by my rules)
-2 - redirected
-3 - errorI use the following scheme:
1 - exhausted
0 - alive
-1 - blocked (by my rules)
-2 - redirected
-3 - errorOn my own little SaaS project, the difference between querying an integer and a varchar like “active” is imperceptible, and that’s in a table with 7,000,000 rows.
It would take the author 19 years to run into the scale that I’m running at, where this optimisation is meaningless. And that’s assuming they don’t periodically clean their database of stale data, which they should.
So this looks like a premature optimisation to me, which is why it stood out as odd to me in the article.
You can map meaning onto the column in your code, as most languages have enums that are free in terms of performance. It does not make sense to burden the storage layer with this, as it lacks this feature.
> if you have a sufficiently large database
Roughly 360,000 rows per year is not sufficiently large. It's tiny.
Was just looking at how to do this with an enum today! Read my mind. :)