西维蜀黍

【MySQL】计算磁盘空间使用

统计每个DB的磁盘空间使用

mysql>  select table_schema "DB name (table_schema)",
    -> sum((data_length+index_length)/1024/1024/1024) AS "DB size in GB" from
    -> information_schema.tables group by table_schema;
+-----------------------------+-------------------+
| DB name (table_schema)      | DB size in GB     |
+-----------------------------+-------------------+
| information_schema          |    0.000167846679 |
| xxyyzz_coins_v3_db_00000004 |  210.166442871299 |
| xxyyzz_coins_v3_db_00000004 | 1387.163970947461 |
+-----------------------------+-------------------+
3 rows in set (0.85 sec)
  ...


【SQL】索引 - 增删查改

索引(Index)

索引(Index)是一种特殊的查找表,作用是给数据库搜索引擎用来加快数据检索。

简单地说,索引是一个指向表中数据的指针。一个数据库中的索引与一本书后边的索引是非常相似的。例如,如果你想在一本讨论某个话题的书中引用所有页面,则首先需要指向索引,索引按字母顺序列出了所有主题,然后指向一个或多个特定的页码。

索引有助于加快 SELECT 查询,但它会减慢使用 UPDATEINSERT 语句时的数据输入。

索引可以创建或删除,但不会影响数据。使用CREATE INDEX语句创建索引,它允许命名索引,指定表及要索引的一列或多列,并指示索引是升序排列还是降序排列。索引也可以是唯一的,与 UNIQUE 约束类似,在列上或列组合上防止重复条目。

  ...


【Database】索引 - 数据结构

索引的实现

The B-tree and the Log-Structured Merge-tree (LSM-tree) are the two most widely used data structures for data-intensive applications to organize and store data. However, each of them has its own advantages and disadvantages. This article aims to use quantitative approaches to compare these two data structures.

  ...


【Data Structure】稀疏索引(Sparse Indexes)

稀疏索引(Sparse Indexes)

One quality that database indexes can have is that they can be dense or sparse. Each of these index qualities come with their own trade-offs. Let’s look at how each index type would work using the following user data.

  ...


【Data Structure】跳跃表(Skiplist)

  ...