-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlocal-search.xml
More file actions
58 lines (27 loc) · 7.24 KB
/
local-search.xml
File metadata and controls
58 lines (27 loc) · 7.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="utf-8"?>
<search>
<entry>
<title>Mysql和Mongodb</title>
<link href="/2023/03/28/Mysql%E5%92%8CMongodb/"/>
<url>/2023/03/28/Mysql%E5%92%8CMongodb/</url>
<content type="html"><![CDATA[<h2 id="关系型数据库和非关系型数据库区别"><a href="#关系型数据库和非关系型数据库区别" class="headerlink" title="关系型数据库和非关系型数据库区别"></a>关系型数据库和非关系型数据库区别</h2><p>SQL之所以称为<strong>关系型数据库</strong>,是因为它将结构化数据组织定义为行和列,每个表都与数据库中的其他表相关。</p><p>另一方面,NoSQL被称为非关系数据库,这是因为数据以集合的形式存储,它们之间没有或只有很少的关系。关系型数据库强调数据的一致性。</p><h2 id="Mongodb"><a href="#Mongodb" class="headerlink" title="Mongodb"></a>Mongodb</h2><p>具有关系:嵌入式关系和引用式关系</p><p>嵌入式:直接将需要嵌入的N个字段写入一个字段中<br>引用式关系:通过ObjectId实现</p><p>索引底层:B树<br>索引类型:主键索引、组合索引等等</p><p>存储方式:虚拟内存+持久化。</p><p>查询语句:是独特的Mongodb的查询方式。</p><p>适合场景:事件的记录,内容管理或者博客平台等等。</p><p>架构特点:可以通过副本集,以及分片来实现高可用。</p><p>数据处理:数据是存储在硬盘上的,只不过需要经常读取的数据会被加载到内存中,将数据存储在物理内存中,从而达到高速读写。</p><h2 id="对比"><a href="#对比" class="headerlink" title="对比"></a>对比</h2><p>当考虑使用大型数据库时,与MongoDB相比,MySQL的运行速度很慢。这主要是由于MySQL无法用于大量和非结构化的数据。但是,MongoDB具有处理大型非结构化数据的能力。因此,它比考虑大型数据库的MySQL更快,因为它允许用户以减少服务器负载的方式进行查询。</p><p>MySQL支持主从复制和主主复制。另一方面,MongoDB支持内置的复制,分片和自动选择。因此,借助MongoDB中的自动选择,您可以设置另一个数据库或辅助数据库,以在主数据库发生故障时自动接管。</p><h2 id="Why-Mongodb-is-faster"><a href="#Why-Mongodb-is-faster" class="headerlink" title="Why Mongodb is faster"></a>Why Mongodb is faster</h2><h3 id="1-针对写入操作"><a href="#1-针对写入操作" class="headerlink" title="1.针对写入操作"></a>1.针对写入操作</h3><p>MongoDB的写入速度更快。写操作MongoDB比传统数据库快的根本原因是Mongo使用的内存映射技术 - 写入数据时候只要在内存里完成就可以返回给应用程序,这样并发量自然就很高。而保存到硬体的操作则在后台异步完成。注意MongoDB在2.4就已经是默认安全写了(具体实现在驱动程序里)</p><h3 id="2-针对读取操作"><a href="#2-针对读取操作" class="headerlink" title="2.针对读取操作"></a>2.针对读取操作</h3><p>如果是针对等值查询(如=1),MongoDB会更快一些。但针对范围查询,则MySQL更快一些。</p><p>读操作MongoDB快的原因是:<br>1)MongoDB的设计要求你常用的数据(working set)可以在内存里装下。这样大部分操作只需要读内存,自然很快。<br>2)文档性模式设计一般会是的你所需要的数据都相对集中在一起(内存或硬盘),大家知道硬盘读写耗时最多是随机读写所产生的磁头定位时间,数据集中在一起则减少了关系性数据库需要从各个地方去把数据找过来(然后Join)所耗费的随机读时间</p><h2 id="使用场景"><a href="#使用场景" class="headerlink" title="使用场景"></a>使用场景</h2><p>总体上看,如果项目的<strong>数据模式是固定的</strong>,而且<strong>不需要频繁变更</strong>,推荐使用 <strong>MySQL</strong>,因此项目维护容易,而且确保了数据的完整性和可靠性。</p><p>另一方面,如果项目中的<strong>数据持续增加</strong>,而且<strong>数据模式不固定</strong>,MongoDB 是最合适的选择。由于它属于非关系数据库,数据可以自由使用,不需要定义统一的数据结构,所以对数据进行更新和查询也很方便。MongoDB 通常用于需要对内容进行管理、处理物联网相关业务、进行实时分析等功能的项目中。</p>]]></content>
<tags>
<tag>Database</tag>
</tags>
</entry>
<entry>
<title>distributed system</title>
<link href="/2021/07/30/distributed-system/"/>
<url>/2021/07/30/distributed-system/</url>
<content type="html"><![CDATA[]]></content>
<tags>
<tag>Distributed System</tag>
</tags>
</entry>
<entry>
<title>Hello World</title>
<link href="/2021/02/15/hello-world/"/>
<url>/2021/02/15/hello-world/</url>
<content type="html"><![CDATA[<p>Welcome to <a href="https://hexo.io/">Hexo</a>! This is your very first post. Check <a href="https://hexo.io/docs/">documentation</a> for more info. If you get any problems when using Hexo, you can find the answer in <a href="https://hexo.io/docs/troubleshooting.html">troubleshooting</a> or you can ask me on <a href="https://github.com/hexojs/hexo/issues">GitHub</a>.</p><h2 id="Quick-Start"><a href="#Quick-Start" class="headerlink" title="Quick Start"></a>Quick Start</h2><h3 id="Create-a-new-post"><a href="#Create-a-new-post" class="headerlink" title="Create a new post"></a>Create a new post</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo new <span class="hljs-string">"My New Post"</span><br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/writing.html">Writing</a></p><h3 id="Run-server"><a href="#Run-server" class="headerlink" title="Run server"></a>Run server</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo server<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/server.html">Server</a></p><h3 id="Generate-static-files"><a href="#Generate-static-files" class="headerlink" title="Generate static files"></a>Generate static files</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo generate<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/generating.html">Generating</a></p><h3 id="Deploy-to-remote-sites"><a href="#Deploy-to-remote-sites" class="headerlink" title="Deploy to remote sites"></a>Deploy to remote sites</h3><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">$ hexo deploy<br></code></pre></td></tr></table></figure><p>More info: <a href="https://hexo.io/docs/one-command-deployment.html">Deployment</a></p>]]></content>
</entry>
</search>