5 ms·
MySQL and Postgres are awesome for a lot of what websites do. They have advantages and disadvantages. Things like sharding tend to be premature optimizations
by schleyfox 15y ago
MySQL and Postgres are awesome for a lot of what websites do. They have advantages and disadvantages. Things like sharding tend to be premature optimizations except for write-heavy sites running at high scale. I prefer a mixture of SQL and NoSQL for the projects I work on. Redis, especially, is great at things like atomic updates and counters that become cumbersome in sql. With a well architected model-layer the complexity of multiple datastores can be minimized significantly. By using the right tools for the job, we are often able to simplify even versus using one database and a hacky solution.
- joevandyk 15y agoIsn't updating a counter in SQL just: update counters set amount = amount + 1 where id = something?
- clojurerocks 15y agoIn a basic application yes this is true. But if you have a large cluster and data is spread out it becomes more difficult not to mention time consuming to run that query. With redis and other nosql solutions they are designed with this in mind so they are much faster and easier.
- dramaticus3 15y agoYou didn't check for overflow.
- ars 15y agoDon't check for overflow. Simply use a data type so large that it would take centuries to overflow. If you were doing a million increments per second it would take almost 600,000 years to overflow a 64 bit int.
- dramaticus3 15y agoCheck your assumptions. The field could be updated at any time to any value by another connection. And who's to say we started at zero.