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.

Ask HN: Things you wish you knew about databases before building an app?

10 pointsby praveenwebalmost 4 years ago
As a frontend or fullstack developer, what are some things you wish you knew about databases for building an app.<p>This could be anything like using connection strings, CLI tools, user Grants, GUI, writing optimised queries, adding indexes for performance, how SQL views can be leveraged etc.

5 comments

bwh2almost 4 years ago
The biggest thing is avoiding database structures that will be difficult to work with later, requiring data migrations to escape the dilemna.<p>The book SQL Antipatterns is a good read on this subject. But realistically, I think you need to work in a few production databases and experience these problems before you deeply understand them enough to understand why they are antipatterns.
tafferalmost 4 years ago
- You cannot have a good database design without understanding the business requirements first<p>- Designing the code around the database leads to cleaner designs than doing it the other way around<p>- Almost all columns should be NOT NULL<p>- EXPLAIN helps you understand what the database does under the hood
评论 #27518029 未加载
评论 #27517336 未加载
DarrenDevalmost 4 years ago
Never store two different types of information in the same table, even if the structure is identical. They may be identical today -- they won&#x27;t be in two years time.<p>If you&#x27;re unsure about this, ask yourself if your table has a column called &#x27;type&#x27; or something similar. If it does, a big migration awaits you a year or two down the road, and you&#x27;ll have a lot of pain between now and then.
joshxyzalmost 4 years ago
Always do a reality check if this xyz thing directly relates to the business goals, in a timely manner.
klausnroosteralmost 4 years ago
Can&#x27;t find good link now, but the fact SQL is based on a kind of Bag Logic as opposed to the logic of Sets.