3 ms·
Avoid using lesser known features... They're the ones that will be hardest to migrate to a different database, most likely to be deprecated, and least likely t
by londons_explore 5y ago
Avoid using lesser known features...
They're the ones that will be hardest to migrate to a different database, most likely to be deprecated, and least likely to be understood by the next engineer to fill your shoes.
While many of these are neat, good engineering practice is to make the simplest thing to get the job done.
- gmfawcett 5y agoI'm not sure why you are being downvoted. Your argument is reasonable and clearly presented, and "do the simplest thing that can work" is a tried and true design philosophy.
- handrous 5y agoCounterpoint: Databases often outlive applications. Database features usually do what they do very quickly and reliably. Used well, a full-featured database can make things like in-place refactors or re-writes of your application layer far easier, make everyday operation much safer, as well as making it much safe & useful to allow multiple applications access to the same database, which can be very handy for all kinds of reasons. > While many of these are neat, good engineering practice is to make the simplest thing to get the job done. That, or, use the right tool for the job.
- pyentropy 5y agoI'd rather have a non-portable SQL feature than an app-level "portable" implementation that almost certainly is slower and non-transactional. Migrating to another DB will always take work, no matter how much you try to ignore flavor-specific features. Query planning, encoding and charsets, locking abilities tend to be very different. A query can run fine in MySQL and cause a deadlock in Postgres even though it's syntactically valid in both.
- tengbretson 5y agoEven the most obscure Postgres features are documented better than whatever code a dev would write in order to avoid using them.
- sodapopcan 5y agoHow often does migrating databases ever actually happen? I'm not saying it doesn't happen, but I've never experienced it or know anyone who has (I've asked!). I certainly would shy away from using features that make my app code cleaner and improves the all-around performance of the app on the slim-to-none chance that one day I might one day have to migrate off of postgres.
- handrous 5y ago20-year career so far. Never seen a database swapped out. I've seen "apps" replaced on top of databases, or more programs added to access the same database. I've seen the app and database both get thrown out and replaced, because they were tightly coupled[0], as the parent advocates (Rails + ActiveRecord seems to be prime for this kind of "gotta throw it all out" situation). I've never seen the program stay the same while the DB is swapped out from under it. [0] yes, that's actually tightly coupling them, because now your DB is too unsafe to use without the "app" you built on top, and doesn't provide enough functionality to make it worth trying to retrofit that safety onto it.
- williamdclt 5y agoI've seen it firsthand, but we're talking about an early-stage startup moving from MySQL to Postgres. It's definitely not enough to convince me not to use database-specific features.
- amichal 5y agoI’ve added an activrecord interface to an existing schema (on sql server no less). A lot of overriding of it’s assumptions and sometimes preventing writes via active record but it is doable.
- amichal 5y ago20 years ago I ported an app from Microsoft SQL server to Oracle as a new requirement from the incoming CTO equivalent. I was told the whole place was standardizing on Oracle as they had in house expertise. Turns out they didn’t and while the port was completed and successful they had no end of trouble managing it. I’ve since ported a few apps in early development or production between Microsoft SQL server, MySQL and Postgres (in various directions) but nothing in prod in over 10 years