Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
I can only guess as @dfox or @trogus did the design and as far as I can tell it is not open source...
But usually aggregate counts are in databases what one would call "two bladed swords".
It can be fine and dandy if the table is either not fragmented (data which needs to be gathered is not scattered across the table, e.g. when indexed by a primary index and not indexed by secondary index *depends on database storage engine™) or cleverly partitioned (although this isn't as easy as it sounds....), but in most cases it's a pain in the arse. You can collect easily, but sooner or later the aggregate querys runtime is dependent on how much data exists / how it is distributed across the table / ... .
It becomes a russian roulette - and the number of variances isn't determinable I guess.
That's the reason you avoid this and keep usually simple aggregatable stuff either in a separate column or utilize statistic tables (or other clever shenanigans, like persistent virtual tables) to spare yourself from having an aggregation query whose runtime can be anything between lightning fast and oops I died while waiting for the result.
CurtisMJ5262yI think it's a column. There was a thing a while ago where the counts were out of sync and they took the site down for maintenance to recount everyone's points. Any karma affecting action just adds to the points atomically.
@IntrusionCM @CurtisMJ That's cool to know.
Voxera116342y@CurtisMJ I agree that this is most likely true.
Having worked with some very large datasets I know that up to a point you can get away with recounting every time but past the trigger point (usually memory dependent) speed drops of by many magnitudes as not only does each query take more time but they also cause delays in following questions and a site can actually grind to almost standstill in a very short time.
So any data that you want to fetch often should be precomputed.
This is also why major ticket releases for concerts and similar often get bogged down, when selling a limited stock you cannot use precomputed data bit must operate on live one, and that is a hard problem :)
Where do you see that 5000+ thing though?
@nitwhiz You got 12000+ thing
@Goobernet wtf. Never seen it, all counts are exact for me.
Spoiler: This might be a dumb question
In this platform the rant count is showing for all people like a badge. And we can see that whenever someone comment in a feed or near the posted person. Do they have a separate column to keep track of rants ( ++ ) or is it a overload to call db count query of all ++ they recieved by various post and people because some people have 5000+ whenever their name appears