Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Ah, so a view that aggregates all transactions. Not a bad idea, but, there could be many, many transactions...millions. I am storing both user-level transactions AND site-level transactions (I'm using Mongo, so hence the optional-ness of transactions.userId). So, in a site-level transaction, I need to log the current site balance, and since transactions will happen frequently (let's say 10 per second), I would think an aggregation query would have a negative impact on performance. Commented Nov 5, 2014 at 18:59
  • Ah. That wasn't clear from your question. I'll update my answer... Commented Nov 5, 2014 at 20:54
  • 1
    Depending on the stats you need, you might be able to remove the need for aggregate queries (either updating after each transaction, periodic queries, views, etc) by using a running tally system. As a transaction is added, add that value to the your total as well. Commented Nov 5, 2014 at 22:52
  • @GrandmasterB Wouldn't the tally system be the same as what I would be doing with the stats table (keeping a summary and using that to log the balance in each new transaction)? If not, how does a tally system differ? Commented Nov 6, 2014 at 0:04