Read more feature in hexo

When I am using the hexo as my blog system, I found one big problem that really frustrate me. In the home page of my blog website, articles are displayed at full content and that makes the page size so big and the loading time extraordinary long.

《函数式编程入门:使用 Elixir》笔记 1

基本思想

函数式编程是一种编程范式。编程范式包括构建软件的规则和设计原则,侧重于使用纯函数构建软件,这些函数的描述方式是要怎么样,而不是使改如何做!使用像 Elixir 这样的函数式语言,可以更好地利用多核 CPU,编写更简洁的代码。在函数式语言中使用函数范式,可以编写出更和谐的程序。前提是要理解其核心概念:不可变性函数声明式代码

Something about code review

Recently, I was reading some articles which are about the code review. As a software developer, we all know the importance of the code review. But eventually, we will all ignore or put less attention on this step. When I was surfing the Internet, I found Google wrote some pages to explain how they do the code review and which kind of things that we as a reviewer should be aware of.

一些 SQL Server 的小技巧

记得备份!备份!备份!

以下我会记录一些我在实际工作中遇到的或者看到别人记录下的关于 SQL Server 的用法和小技巧。文章会不定期的更新。

Using Docker (Compose) to host SQL Server AdventureWorks DB

Recently, I am learning the SQL Server performance tunning and the book I am using is using the AdventureWorks database as the sample database. And I don’t want to install the SQL Server Engine in my Surface, not even the Express version. So I am thinking about using the Docker to host my database. After some investigations and tries, I figured it out.

《SQL Server 性能调优实战》笔记 1

T-SQL 语句编写的一些简单方针

  1. 编写语句前,一定要了解业务需求。
  2. 确定过滤字段能否使用索引,是否合理。重复率是一个指标,可以通过查询统计信息获得。
  3. 不要对有索引的字段使用任何计算,包括函数。
  4. 小表操作优先,用小表驱动大表。执行计划里尽量是 NESTED LOOP。
  5. 只返回必要的字段。
  6. 保持 SQL 语句简单。
    • 只简单的存在 2~4 个表的关联。
    • 不要有复杂的过滤条件,只有 2~3 个条件判断。
    • 越复杂的语句在业务量大的系统中,越会有“变异”的可能性。适度考虑用固定执行计划
    • 如果要 order by 的话,尽量使用有索引的字段进行。
    • 不要遗漏 join 关键字,不然的话容易发生笛卡尔积。

SELECT 语句

  1. 只查询需要的字段。
  2. 限定查询的结果集的大小。
  3. 高效的使用和建立索引来提高性能。

ORDER BY/DISTINCT/GROUP BY

从索引的角度分析

1
2
3
4
5
6
7
8
9
USE AdventureWorks2019
GO

SELECT
sod.OrderQty,
sod.ProductID
FROM Sales.SalesOrderDetail AS sod
WHERE sod.ProductId = 870
ORDER BY sod.OrderQty DESC

默认情况下的执行计划和 I/O 情况如下所示:

移除 Git 里面的 Submodule

最近在整理我的博客项目中,用到了 hexo 的 next 主题,因为主题的原作者仓库的地址发生了变化,所以我也相应的 fork 了新的仓库,从而需要更新已有的博客项目中的 module 引用。下面我把步骤列出,以备后用 :)