5 ms·
Nullable timestamp columns (64-bit integers) are what I prefer. I don't know how much of a performance improvement I'd get if I had a separate indexed bool col
by bob1029 4y ago
Nullable timestamp columns (64-bit integers) are what I prefer.
I don't know how much of a performance improvement I'd get if I had a separate indexed bool column for tracking just the truthiness, but I do know that it probably wouldn't be enough to matter, even if SQL was a meaningful bottleneck.
I really enjoy working with these as nullable DateTime in .NET as well:
if (!record.CompletedUtc.HasValue) { /* completion logic */ }
One source of truth also means only 1 thing to update each time. It makes many kinds of problems impossible.
- rektide 4y agoIndexing a 64 bit versus a 1 bit column actually sounds like a potentially really good win to make the index much much smaller, which could help loads with keeping it in hot memory or cache. On the other hand, on postgres & maybe others, one could perhaps index an expression deleted_at is not null, which would let one have the data shape they want while letting the index shape suit the typical access pattern.