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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

SQL vs. NoSQL

55 点作者 thinkerer将近 11 年前
Theres a lot of debate on this and I understand theres no clear answers. Just wanted to hear some of your experiences working with both and whats applicable for what type of systems. I myself am working on a database for a web app analytics tool and witnessed some benefits of NoSQL while SQL is supposedly more reliable.<p>Understand companies like Amazon have shifted to NoSQL to manage their data. In short, I do think that SQL is for high processing, low disk space while NoSQL is vice versa in layman terms. Im pretty new to programming and appreciate a healthy discussion on this.<p>Please do not draw lines and have hate posts and all. Keep the discussion clean and intelligent.<p>Thanks!!

8 条评论

twic将近 11 年前
<i>The problem with SQL is it seems everyone hates its guts. It is a weird obtuse kind of &quot;non-language&quot; that most programmers can&#x27;t stand.</i><p>I&#x27;m baffled. I&#x27;m a programmer and i rather like SQL. Most programmers i know use SQL quite happily. Indeed, i often hear them wishing they could just write SQL to solve some problem rather than use some API that purports to save you from writing SQL.<p>I certainly prefer SQL to MongoDB&#x27;s query language, which is verbose and unexpressive by comparison.<p>Am i in a tiny minority? Or is this SQL hatred a popular myth?
评论 #7829071 未加载
评论 #7829413 未加载
评论 #7829001 未加载
评论 #7829014 未加载
评论 #7829331 未加载
评论 #7829262 未加载
评论 #7829297 未加载
评论 #7828908 未加载
评论 #7828888 未加载
评论 #7829347 未加载
评论 #7828886 未加载
SchizoDuckie将近 11 年前
A project from 2010 that&#x27;s stalled half-way through in alpha state.<p>Still, he is quite correct. You still need a Structured Data Query Language.
评论 #7828737 未加载
vertex-four将近 11 年前
Personally, I find that SQL is hard to <i>generate</i>. It&#x27;s hard to reason about the creation of dynamic queries, say, for some types of searches. It&#x27;s not reasonable to create a generic function that can operate on any same-shaped piece of data. And it&#x27;s ridiculously hard to manage the concept of a pointer to a piece of data which could be one of many types, a problem I&#x27;m sure most people have faces.<p>Stored procedures can help with some of this, but then you&#x27;ve got to remember to update them every time you need to access data in a slightly different way, and it&#x27;s hard to figure out when you can get rid of old stored procedures. Tools for managing them aren&#x27;t up to scratch with tools for managing &quot;real&quot; programs.<p>Personally, I&#x27;m keen on RethinkDB. It&#x27;s a document-oriented NoSQL database which doesn&#x27;t lose your data, has built-in clustering, and an extremely strong query language built on chaining method calls. While it doesn&#x27;t have transactions, the query language is powerful enough that you can easily model most forms of deterministic data transformation within a single query.
daleharvey将近 11 年前
There is some irony in opening the post proclaiming how important SQL is because of webSQL, webSQL has hung on by being the only choice with Safari, with Apple almost certainly adopting IndexedDB webSQL will cease to exist in any relevance pretty quickly (its already fairly niche).<p>This post is just filled with naive strawmen arguments, I work on a NoSQL database, show me a SQL database that is implemented embedded inside every browser and allows offline operations to sync between masters transparently ...<p>Trying to define or dismiss &#x27;NoSQL&#x27; as a singular movement is not going to work, there are lots of tools, I use different ones for different things, some of them even have a SQL interface.
评论 #7828840 未加载
评论 #7828849 未加载
bitL将近 11 年前
I&#x27;ll just put a few points here to understand when you should use which architecture.<p>NoSQL:<p>- reading is fast, writing is expensive (if all data are pre-processed&#x2F;denormalized for reading during the writing phase)<p>- often schema-less<p>- low latency (for key-value storage)<p>- offline batch processing (classical Map Reduce)<p>- no ACID, choose 2 of 3 in CAP<p>- demanding on SW engineers to get client-side conflict resolution, tricky in general<p>- Petabytes of data can be suddenly processed<p>- huge variation of different paradigms, key-value, document, graph, batch etc.<p>- haywire indexing<p>SQL:<p>- writes are fast (normalization), reads are expensive (JOINs)<p>- ACID (well, only to some extent, clustering messes up many ACID properties unfortunately and conflicts arise in corner cases)<p>- set operations and a neat math theory behind them<p>- stable indexing, easily constructable real-time JOINs<p>- OLTP<p>- easier for developers<p>- non-flexible schema<p>- tradition, well-known recipes on how to do things<p>Basically, if you want to have low-latency access, your concurrency model allows eventual consistency, or you have a need to store your data in non-standard structure such as graphs&#x2F;trees, use NoSQL and pre-process all data to be exactly in the format you require for reading.<p>If you need 99.999% guarantee of consistent data, amount of data you need to handle is under 50TB, you can put your data into a fixed schema and latency doesn&#x27;t matter that much, use SQL.<p>I would recommend you to ask yourself a question - is your app&#x2F;business read-heavy or write-heavy and decide accordingly.
nawitus将近 11 年前
&gt;The NoSQL movement is partially a reaction to antiquated database servers, and also a response to a fear of SQL borne from ignorance of how it works<p>I think the NoSQL movement was created for practical reasons. Since SQL didn&#x27;t scale properly for certain applications, new kinds of databases had to be invented. What often happened is that a software used a typical SQL database with locks, and as that didn&#x27;t scale, the locks were decreased to a point ACID wasn&#x27;t theoretically guaranteed anymore. And it worked.<p>If the database in production doesn&#x27;t guarantee consistency, you might aswell design a new database which is based on that idea, which is a core reason NoSQL databases were created. There&#x27;s other reasons, too, of course..
评论 #7828917 未加载
dorfsmay将近 11 年前
He is right, the issue has been servers not scaling horizontally.<p>SQL the query language is great, the concept of set theory applies really well to data. SQL can be and is used on non-SQL database, impala for example implements SQL to query data burried in hadoop.<p>NoSQL stores become popular because they scale horizontally (able to use more than one server) naturally. Once the SQL servers can do automatic partitioning, I suspect people will start migrating back.<p>The truth is that there is no pixie dust, at the end of the day you need to index. I see nosql proponent having the same strugles sql people have with indexing, but right now they have the upper hand because they can spread the work over several servers.
评论 #7829187 未加载
SimeVidas将近 11 年前
&gt; Or Why You Still Need SQL<p>Great way to make people close the page immediately after reading the title. (I personally don&#x27;t need SQL for my small web app =&gt; the title&#x27;s lying =&gt; close tab).
评论 #7829111 未加载