TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The SQL Trap

10 点作者 petewarden将近 16 年前

6 条评论

DenisM将近 16 年前
On the flip side if you know your SQL you'll be running circles around the competitors who are manually coding up all those joins, sorts and enforcing the data integrity.<p>It's kind of like lisp in that regard...
评论 #670678 未加载
kragen将近 16 年前
Was a nice surprise to open the page and see my wife's photo headlining it!<p>I agree that there are some things SQL databases aren't suitable for, but it's very often the case that something that's too slow in SQL stops being too slow once you tweak the right thing. When that's possible (as I said, that's very often but not always), actually doing the tweak is much simpler than reimplementing the subset of a DBMS that you need, but learning enough about the DBMS to figure out what to tweak may not be.<p>Here are some things I haven't found a good SQL solution to:<p>* Inverted indices. Fortunately, this is a big enough use that a lot of SQL databases these days have a full-text search extension of some kind slapped on the side.<p>* Graph data. This is kind of the same problem; the issue is that you can store your RDF or whatever in a table with <i>subject</i>, <i>verb</i>, and <i>object</i> columns, but not only are N-way self-joins an awkward way to query it, the SQL optimizer isn't smart enough to figure out that some verbs are orders of magnitude more common than others, and it should plan accordingly. (Not in PostgreSQL or SQLite, anyway, and I don't think in MySQL either.)<p>* Data of many terabytes. Use Hadoop.
dxjones将近 16 年前
I wonder if the author could share something about his startup/web/app that is so ill-suited to MySQL and so much more efficient when implemented using a simple key-value store, plus algorithms in PHP?<p>I'm just wondering whether this observation has more to do with the nature of your "computational problem", or maybe just a difference in skill level with MySQL queries vs PHP algorithms.
评论 #669795 未加载
lsb将近 16 年前
This is a false binary. It's not just using SQL vs using a Key/Value store. Caching/denormalization speeds up almost any algorithm; store a query result into memcached to make it even faster.<p>Scale up and get the biggest box with the most RAM you can find, and if you can afford your entire dataset in 15 GB of RAM for $300/mo in a 3 year contract, congrats, use EC2 Extra Large and you're golden.
kevbin将近 16 年前
The PHP trap is worse than any SQL trap.
javert将近 16 年前
Newer hackers should know that parsing text files is a good alternative to using a database for many web apps, esp. in early stages.
评论 #669752 未加载
评论 #669755 未加载