TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Common data model mistakes made by startups

175 pointsby ReginaDeiPiratialmost 4 years ago

21 comments

rm999almost 4 years ago
&gt;Soft deletes<p>This section is totally wrong IMO. What is the alternative? &quot;Hard&quot; deleting records from a table is usually a bad idea (unless it is for legal reasons), especially if that table&#x27;s primary key is a foreign key in another table - imagine deleting a user and then having no idea who made an order. Setting a deleted&#x2F;inactive flag is by far the least of two evils.<p>&gt;when multiplied across all the analytics queries that you’ll run, this exclusion quickly starts to become a serious drag<p>I disagree, modern analytics databases filter cheaply and easily. I have scaled data orgs 10-50x and never seen this become an issue. And if this is really an issue, you can remove these records in a transform layer before it hits your analytics team, e.g. in your data warehouse.<p>&gt;soft deletes introduce yet another place where different users can make different assumptions<p>Again, you can transform these records out.
评论 #27251168 未加载
评论 #27249738 未加载
评论 #27249919 未加载
评论 #27249952 未加载
评论 #27251150 未加载
pyrophanealmost 4 years ago
I think the biggest mistake some startups make wrt their data model is not really thinking about it at all. The data model winds up being the byproduct of all the features they&#x27;ve implemented and the framework and the libraries they&#x27;ve used, rather than something that was deliberately designed.
评论 #27250157 未加载
评论 #27249268 未加载
评论 #27250477 未加载
评论 #27249210 未加载
评论 #27251626 未加载
评论 #27257013 未加载
rectangalmost 4 years ago
Metabase provides business analytics, and this list of &quot;common mistakes&quot; is weighted towards &quot;choices which get in the way of business analytics&quot;.<p>For example:<p>&gt; <i>1. Polluting your database with test or fake data</i><p>&gt; <i>[...] By polluting your database with test data, you’ve introduced a tax on all analytics (and internal tool building) at your company.</i>
评论 #27249332 未加载
评论 #27248874 未加载
handrousalmost 4 years ago
&gt; 5. The “right database for the job” syndrome<p>I once saw something a little similar to this, except with one flavor of DB rather than several. A company you&#x27;ve likely heard of went hard for a certain Java graph database product, due to a combination of an internal advocate who seemed determined to be The GraphDB Guy and an engineering manager who was weirdly susceptible to marketing material. This because some of their data could be represented as graphs, so clearly a graph database is a good idea.<p>However: the data for most of their products was tiny, rarely written, not even read that much really, even less commonly written concurrently, and was naturally sharded (with hard boundaries) among clients. Their use of that graph database product was plainly contributing to bugginess, operational pain, mediocre performance (it was reasonably fast... as long as you didn&#x27;t want to both traverse a graph and fetch data related to that graph, then it was laughably slow) and low development velocity on multiple projects.<p>Meanwhile, the best DB to deliver the features they wanted quickly &amp; with some nice built-in &quot;free&quot; features for them (ability to control access via existing file sharing tools they had, for instance) was probably... SQLite.
评论 #27253099 未加载
konhaalmost 4 years ago
&gt; On the flip side, soft deletes require every single read query to exclude deleted records.<p>You can use partial indexes to only index non-deleted rows. If you are worried about having to remember to exclude deleted rows from queries: Use a view to abstract away the implementation detail from your analytics queries.
评论 #27253089 未加载
ridajalmost 4 years ago
I would personally add:<p>- Having informal metrics and dimension definitions: you throw together something quick and dirty and then realize there&#x27;s something semantically broken about your data definitions or unevenness. For example your Android app and iOS apps report &quot;countries&quot; differently, or they have meaningfully different notions of &quot;active users&quot;<p>- Not anticipating backfill&#x2F;restatement needs. Bugs in logging and analytics stacks happen as much as anywhere else, so it&#x27;s important to plan for backfills. Without a plan, backfills can be major fire drills or impossible.<p>- Being over-attentive to ratio metrics (CTR, conversion rates) which are typically difficult to diagnose (step 1 figure out whether the numerator or the denominator is the problem). Ratio metrics can be useful to rank N alternatives (eg campaign keywords) but absolute metrics are usually more useful for overall day to day monitoring.<p>- Overlooking the usefulness of very simple basic alerting. It&#x27;s common for bugs to cause a metric to go to zero, or to be double counted, or to not be updated with recent data, but often times even these highly obvious problems don&#x27;t get detected until manual inspection.
评论 #27249068 未加载
bryliealmost 4 years ago
If your company has a subscription business model, keep a history of user&#x27;s subscriptions. They change over time and it is likely you will need to measure popularity and profitability of product offerings over time. Please don&#x27;t force your analytics team to rely on event logs to reconstruct a subscription history.
评论 #27249330 未加载
评论 #27253246 未加载
评论 #27249303 未加载
FriedrichNalmost 4 years ago
I have seen so many people argue against soft deletes over the years. But I have also had so many instances where users &#x27;accidentally&#x27; deleted a bunch of items and then call support to ask if there are any backups. And then I&#x27;ll have to reconstruct the data from yesterday&#x27;s backup plus today&#x27;s changes. A soft delete will take care of this.<p>And no amount of &quot;are you really really really sure you want to delete this?&quot; confirmations are going to fix this. You could require the whole Spongebob Squarepants ravioli ravioli give me the formuoli song and dance and people will still delete hundreds or thousands of records by accident.
评论 #27253325 未加载
ineedasernamealmost 4 years ago
<i>Polluting your database with test or fake data</i><p>Maybe I&#x27;ve been spoiled, but isn&#x27;t it common to have dev, test, and prod instances? Possibly multiples of the former 2?
评论 #27254922 未加载
评论 #27251066 未加载
dugmartinalmost 4 years ago
I would add to their semi structured data fields section a suggestion to add a version or type key. Otherwise your code consuming those field may grow over time to a bunch of conditionals to figure what is in the json.
worikalmost 4 years ago
In my experience I would add: Building systems out of &quot;lego blocks&quot;.<p>It is possible to get all the pieces that are needed to build a data server for a enterprise pre built form cloud providers. Then plumb them together so the mostly work.<p>When the heat comes on and peopel are using it for real and it must scale (even a little) it blows up horribly.<p>The &quot;leggo bricks&quot; save a lot of time and money, and mean that people with only half a clue can build large impressive looking systems, but in the end people like ,e are picking up the pieced
nivertechalmost 4 years ago
There are advantages for soft deletes for CRUD architecture, but are there any for CQRS&#x2F;ES (Event Sourcing)?<p>I guess if your read model is based on RDBMS then it makes sense, otherwise it depends on the database system in question (i.e. some NoSQL databases like C*[1] and Riak[2] are implementing deletes by writing special tombstone values, which is kind of soft-delete but on the implementation level - but you can&#x27;t easily restore the data like in case of RDBMS).<p>[1] <a href="https:&#x2F;&#x2F;thelastpickle.com&#x2F;blog&#x2F;2016&#x2F;07&#x2F;27&#x2F;about-deletes-and-tombstones.html" rel="nofollow">https:&#x2F;&#x2F;thelastpickle.com&#x2F;blog&#x2F;2016&#x2F;07&#x2F;27&#x2F;about-deletes-and-...</a><p>[2] <a href="https:&#x2F;&#x2F;docs.riak.com&#x2F;riak&#x2F;kv&#x2F;latest&#x2F;using&#x2F;reference&#x2F;object-deletion&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;docs.riak.com&#x2F;riak&#x2F;kv&#x2F;latest&#x2F;using&#x2F;reference&#x2F;object-...</a>
jasonhanselalmost 4 years ago
&gt; Typically semi-structured data have schemas that are only enforced by convention<p>Technically, in Postgres you can (kind of) enforce arbitrary schemas for semi-structured data using CHECK constraints. Unfortunately this isn&#x27;t well-documented and NoSQL DBs often don&#x27;t support similar mechanisms.
评论 #27249208 未加载
评论 #27253271 未加载
jayd16almost 4 years ago
Whats the best way to construct a session?<p>&gt;The exact definition of what comprises a session typically changes as the app itself changes.<p>Isn&#x27;t this an argument for post-hoc reconstruction? You can consistently re-run your analytics. If the definition changes in code, your persisted data becomes inconsistent, no?
giovannibonettialmost 4 years ago
&gt; Queries for business metrics are usually scattered, written by many people, and generally much less controlled. So do what you can to make it easy for your business to get the metrics it needs to make better decisions.<p>A simple but useful thing is setting the database default time zone match the one where most of your team is (instead of UTC). This reduces the chance your metrics are wrong because you forgot to set the time zone when extracting the date of a timestamp.
评论 #27250773 未加载
评论 #27250750 未加载
评论 #27250794 未加载
elchiefalmost 4 years ago
Some enterprise data model links here:<p><a href="https:&#x2F;&#x2F;dba.stackexchange.com&#x2F;questions&#x2F;12991&#x2F;ready-to-use-database-models-example" rel="nofollow">https:&#x2F;&#x2F;dba.stackexchange.com&#x2F;questions&#x2F;12991&#x2F;ready-to-use-d...</a><p>Instead of soft deletes, move records to a history table<p>I agree w session issue. Had to rebuild sessions before and is a pita compared to just recording them at source
评论 #27257988 未加载
jerrysievertalmost 4 years ago
the one that is missing for me, that is my personal pet peeve:<p>an index for every column in the database. then wondering why inserts are slow.<p>seriously?
评论 #27252872 未加载
etermalmost 4 years ago
A more common thing I think is just trying to collect and hoard too much data.<p>Most of even these worries such as soft deletes disappear if you&#x27;re not trying to keep every scrap of data you can.<p>Focus on the core business requirements and competencies and you likely don&#x27;t need to store the minutae of every interaction forever.
cjfdalmost 4 years ago
It sounds like quite a few of the problems that are mentioned here can be ameliorated using views.
Pxtlalmost 4 years ago
How do you reconcile the first bullet point (polluting data with test data) vs Test In Production being the modern trend? Those sound irreconcilable.
评论 #27252208 未加载
评论 #27249252 未加载
评论 #27252619 未加载
intricatedetailalmost 4 years ago
I am happy that on so many projects we rejected the kool aid and just used postgres and redis. Can&#x27;t remember ever troubleshooting these.